aprikyan / google-books-downloader

An open-source utility to scrape Google Books
MIT License
65 stars 14 forks source link

Books with an id containing a hyphen/dash/underscore are not handled properly #9

Open Eddict opened 3 years ago

Eddict commented 3 years ago

eg. https://books.google.nl/books?id=S-Fu4fGHnlAC eg. https://books.google.nl/books?id=J2jC7gH_4xAC

can be solved by correcting the regex

def get_book_url():

    if re.findall(r"id=[A-Za-z0-9-_]+", url):
        id_part = re.findall(r"id=[A-Za-z0-9-_]+", url)[-1]