<commit_before># -*- coding: utf-8 -*-
import requests
import lxml
from lxml import html

def run():
    "get all books from a given author in saraiva bookstore"    
        
    url = "http://www.skoob.com.br/livro/lista/tag:sarah%20dessen/tipo:autor"

    r = requests.get(url)
    root = lxml.html.fromstring(r.content)
    
    all_infos = root.cssselect("div.dados_lista_busca")
    
    for book_infos in all_infos:
        title = book_infos.cssselect("a.l15ab")[0].text_content()
        print title<commit_msg>more stuff in the skook crawler<commit_after># -*- coding: utf-8 -*-
import requests
import lxml
from lxml import html

main_url = "http://www.skoob.com.br"

def books_for_author(url=None):
    "return the books of a given author"
    print "acessing: %s" % url
    books_found = []

    r = requests.get(url)
    root = lxml.html.fromstring(r.content)
    
    
    all_infos = root.cssselect("div.dados_lista_busca")
    
    print "books in this page:"
    for book_infos in all_infos:
        title = book_infos.cssselect("a.l15ab")[0].text_content()
        books_found.append(title,)
#        print title
        
    next_page = None
    try:
        next_page = root.cssselect("div.proximo span.l13 a")[0].get("href")
        books_found.extend(books_for_author(main_url+next_page))
    except IndexError:
        pass
    
    return books_found

def run():
    "get all books from a given author in saraiva bookstore"    
        
    url = main_url+"/livro/lista/tag:sarah%20dessen/tipo:autor"
    books = books_for_author(url)
    print "============"
    for book in books:        
        print book
{'fraction_non_alphanumeric': 0.11887254901960784, 'fraction_numerical': 0.009191176470588236, 'mean_word_length': 2.6862302483069977, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1853604', 'n_tokens_mistral': 572, 'n_tokens_neox': 568, 'n_words': 126}