mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-02-11 22:14:23 -05:00
Make CodeQL happy
None of these are actual issues, as is usual for CodeQL
This commit is contained in:
parent
85ece7d311
commit
1f69ab8701
@ -124,7 +124,7 @@ def parse_index(raw=None): # {{{
|
||||
return category
|
||||
raise ValueError('Could not find category for offset: ' + str(offset))
|
||||
|
||||
for match in re.finditer(r'''(?is)<li.+?<a\s+href=['"](https://www.mobileread.com/forums/showthread.php\?[pt]=\d+).+?>(.+?)<(.+?)</li>''', raw):
|
||||
for match in re.finditer(r'''(?is)<li.+?<a\s+href=['"](https://www\.mobileread\.com/forums/showthread\.php\?[pt]=\d+).+?>(.+?)<(.+?)</li>''', raw):
|
||||
name, url, rest = u(match.group(2)), u(match.group(1)), match.group(3)
|
||||
category = category_at(match.start(2))
|
||||
deprecated = category == deprecated_category
|
||||
|
||||
@ -398,6 +398,7 @@ class GoogleBooks(Source):
|
||||
timeout=30
|
||||
):
|
||||
from calibre.utils.filenames import ascii_text
|
||||
from polyglot.urllib import urlparse
|
||||
isbn = check_isbn(identifiers.get('isbn', None))
|
||||
q = []
|
||||
strip_punc_pat = regex.compile(r'[\p{C}|\p{M}|\p{P}|\p{S}|\p{Z}]+', regex.UNICODE)
|
||||
@ -440,7 +441,13 @@ class GoogleBooks(Source):
|
||||
pat = re.compile(r'id=([^&]+)')
|
||||
for q in se.google_parse_results(root, r[0], log=log, ignore_uncached=False):
|
||||
m = pat.search(q.url)
|
||||
if m is None or not q.url.startswith('https://books.google'):
|
||||
if m is None or not q.url:
|
||||
continue
|
||||
try:
|
||||
purl = urlparse(q.url)
|
||||
except Exception:
|
||||
continue
|
||||
if not purl.hostname.startswith('https://books.google'):
|
||||
continue
|
||||
google_ids.append(m.group(1))
|
||||
|
||||
|
||||
@ -336,7 +336,7 @@ def google_parse_results(root, raw, log=prints, ignore_uncached=True):
|
||||
purl = urlparse(url)
|
||||
except Exception:
|
||||
continue
|
||||
if 'google.com' in purl.netloc:
|
||||
if purl.hostname.endswith('google.com'):
|
||||
continue
|
||||
try:
|
||||
title = tostring(next(a.iterchildren('span')))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user