mirror of
https://github.com/l1ving/youtube-dl
synced 2025-02-04 22:23:24 +08:00
Get single thumbnail URL from thumbnails(!) array, if thumbnail is empty
This commit is contained in:
parent
dc0cebb5fb
commit
f429827aa7
@ -901,16 +901,13 @@ class YoutubeDL(object):
|
|||||||
if self.params.get('writethumbnail', False) or self.params.get('writeallthumbnails', False):
|
if self.params.get('writethumbnail', False) or self.params.get('writeallthumbnails', False):
|
||||||
# create a list of all thumbnails the user has requested (all or only one)
|
# create a list of all thumbnails the user has requested (all or only one)
|
||||||
allthumbs = []
|
allthumbs = []
|
||||||
if self.params.get('writeallthumbnails', False) and info_dict.get('thumbnails') is not None:
|
if info_dict.get('thumbnails') is not None:
|
||||||
for ele in info_dict.get('thumbnails'):
|
allthumbs = [ ele.get('url') for ele in info_dict.get('thumbnails')]
|
||||||
try:
|
if info_dict.get('thumbnail') is not None:
|
||||||
if ele.get('url'):
|
if self.params.get('writethumbnail', False) or (not info_dict.get('thumbnail') in allthumbs):
|
||||||
allthumbs.append(ele.get('url'))
|
|
||||||
except AttributeError:
|
|
||||||
# not all extractor return dicts
|
|
||||||
allthumbs.append(ele)
|
|
||||||
if info_dict.get('thumbnail') and not info_dict.get('thumbnail') in allthumbs:
|
|
||||||
allthumbs.insert(0,info_dict.get('thumbnail'))
|
allthumbs.insert(0,info_dict.get('thumbnail'))
|
||||||
|
if self.params.get('writethumbnail', False):
|
||||||
|
allthumbs = allthumbs[0:1]
|
||||||
|
|
||||||
allthumblen = len(allthumbs)
|
allthumblen = len(allthumbs)
|
||||||
thumbcnt = 0
|
thumbcnt = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user