Beispiel #1
0
# get titles of books from users to read shelf

for book in soup.findAll('td', 'field title', 'title'):
    titleArr.append(book.getText().replace('title', '').strip())

#  Get Books author

for author in soup.findAll('td', 'field author', 'title'):
    authorArr.append(author.getText().replace('author',
                                              '').replace('*', '').strip())

for rating in soup.findAll('td', 'field avg_rating', 'title'):
    ratingArr.append(rating.getText().replace('avg rating', '').strip())

for isbn in soup.findAll('td', 'field isbn', 'title'):
    isbnArr.append(isbn.getText().replace('isbn', '').strip())

for cover in soup.findAll('img'):
    c = cover.get('src')
    if '.jpg' in str(c):
        coversArr.append(c)

## TODO Pump out a random book
## TODO Learn about making a front end for this

for l in range(len(titleArr)):
    b = Book()
    b.addDetails(titleArr[l], authorArr[l], ratingArr[l], isbnArr[l],
                 coversArr[l])
    bookList.append(b)