mirror of https://github.com/yt-dlp/yt-dlp.git
Don't fail if the video thumbnail couldn't be downloaded (fixes #1516)
Just report a warning
This commit is contained in:
parent
c53f9d30c8
commit
0a60edcfa9
|
@ -545,11 +545,15 @@ class YoutubeDL(object):
|
||||||
thumb_filename = filename.rpartition('.')[0] + u'.' + thumb_format
|
thumb_filename = filename.rpartition('.')[0] + u'.' + thumb_format
|
||||||
self.to_screen(u'[%s] %s: Downloading thumbnail ...' %
|
self.to_screen(u'[%s] %s: Downloading thumbnail ...' %
|
||||||
(info_dict['extractor'], info_dict['id']))
|
(info_dict['extractor'], info_dict['id']))
|
||||||
uf = compat_urllib_request.urlopen(info_dict['thumbnail'])
|
try:
|
||||||
with open(thumb_filename, 'wb') as thumbf:
|
uf = compat_urllib_request.urlopen(info_dict['thumbnail'])
|
||||||
shutil.copyfileobj(uf, thumbf)
|
with open(thumb_filename, 'wb') as thumbf:
|
||||||
self.to_screen(u'[%s] %s: Writing thumbnail to: %s' %
|
shutil.copyfileobj(uf, thumbf)
|
||||||
(info_dict['extractor'], info_dict['id'], thumb_filename))
|
self.to_screen(u'[%s] %s: Writing thumbnail to: %s' %
|
||||||
|
(info_dict['extractor'], info_dict['id'], thumb_filename))
|
||||||
|
except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
|
||||||
|
self.report_warning(u'Unable to download thumbnail "%s": %s' %
|
||||||
|
(info_dict['thumbnail'], compat_str(err)))
|
||||||
|
|
||||||
if not self.params.get('skip_download', False):
|
if not self.params.get('skip_download', False):
|
||||||
if self.params.get('nooverwrites', False) and os.path.exists(encodeFilename(filename)):
|
if self.params.get('nooverwrites', False) and os.path.exists(encodeFilename(filename)):
|
||||||
|
|
Loading…
Reference in New Issue