support new google books api
This commit is contained in:
parent
5296853fab
commit
a2c3e5eaf8
2 changed files with 2 additions and 1 deletions
|
@ -46,6 +46,7 @@ scraper_registry = {}
|
|||
|
||||
def get_normalized_url(raw_url):
|
||||
url = re.sub(r'//m.douban.com/(\w+)/', r'//\1.douban.com/', raw_url)
|
||||
url = re.sub(r'//www.google.com/books/edition/_/([A-Za-z0-9_\-]+)[\?]*', r'//books.google.com/books?id=\1&', url)
|
||||
return url
|
||||
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ from common.scraper import *
|
|||
# https://developers.google.com/books/docs/v1/using
|
||||
class GoogleBooksScraper(AbstractScraper):
|
||||
site_name = SourceSiteEnum.GOOGLEBOOKS.value
|
||||
host = "books.google.com"
|
||||
host = ["books.google.com", "www.google.com/books"]
|
||||
data_class = Book
|
||||
form_class = BookForm
|
||||
regex = re.compile(r"https://books\.google\.com/books\?id=([^&#]+)")
|
||||
|
|
Loading…
Add table
Reference in a new issue