diff --git a/src/calibre/ebooks/metadata/sources/google.py b/src/calibre/ebooks/metadata/sources/google.py index af380836f4..e2f0991e1a 100644 --- a/src/calibre/ebooks/metadata/sources/google.py +++ b/src/calibre/ebooks/metadata/sources/google.py @@ -198,7 +198,16 @@ class GoogleBooks(Source): goog = identifiers.get('google', None) if goog is not None: return ('google', goog, 'https://books.google.com/books?id=%s' % goog) + # }}} + def id_from_url(self, url): # {{{ + url_pattern = '(?:http|https)://books\.google\.com/books\?id=(?P.+)' + url_pattern = re.compile(url_pattern) + id_ = url_pattern.search(url).group('id_') + if id_: + return ('google', id_) + else: + return None # }}} def create_query(self, title=None, authors=None, identifiers={}, capitalize_isbn=False): # {{{