Improve URL parsing for full size images (#521)

Skip URLs that are not two-element lists

Fixes #520
main
Fabian Schilling 2021-11-02 23:22:24 +01:00 committed by GitHub
parent 3784d897d9
commit 9ad1d60a47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -381,6 +381,10 @@ class Filter:
for item in results_all: for item in results_all:
urls = item.find('a')['href'].split('&imgrefurl=') urls = item.find('a')['href'].split('&imgrefurl=')
# Skip urls that are not two-element lists
if len(urls) != 2:
continue
img_url = urlparse.unquote(urls[0].replace('/imgres?imgurl=', '')) img_url = urlparse.unquote(urls[0].replace('/imgres?imgurl=', ''))
try: try: