mirror of
https://github.com/rbreu/beeref.git
synced 2026-03-11 08:54:28 +00:00
fixed freezing if suddenly it was not possible to get an image
This commit is contained in:
parent
3b00e730f6
commit
49c9a84f93
1 changed files with 6 additions and 3 deletions
|
|
@ -93,9 +93,12 @@ def load_image(path):
|
|||
domain = '.'.join(parse.urlparse(url).netloc.split(".")[-2:])
|
||||
img = exif_rotated_image()
|
||||
if domain == 'pinterest.com':
|
||||
page_data = request.urlopen(url).read()
|
||||
root = etree.HTML(page_data)
|
||||
url = root.xpath("//img")[0].get('src')
|
||||
try:
|
||||
page_data = request.urlopen(url).read()
|
||||
root = etree.HTML(page_data)
|
||||
url = root.xpath("//img")[0].get('src')
|
||||
except Exception as e:
|
||||
logger.debug(f'Pinterest image download failed: {e}')
|
||||
try:
|
||||
imgdata = request.urlopen(url).read()
|
||||
except URLError as e:
|
||||
|
|
|
|||
Loading…
Reference in a new issue