I think I've narrowed it down to this block of code. Thoughts?
Quote:
Code:
goodreads_edition_book['goodreads_isbn'] = ''
isbn_node = edition_data_node.xpath('div[@class="moreDetails hideDetails"]/div[@class="dataRow"][2]/div[@class="dataValue"]/span[@class="greyText"]/text()')
if len(isbn_node) > 0:
isbn = None
match_isbn = re.search(': (\d+)', isbn_node[0])
if not match_isbn:
match_isbn = re.search('(\d+)', isbn_node[0])
if match_isbn:
isbn = match_isbn.groups(0)[0]
if check_isbn(isbn):
goodreads_edition_book['goodreads_isbn'] = isbn
goodreads_edition_books.append(goodreads_edition_book)
|