Retrieve the URLs of all availale thumbnails
This commit is contained in:
parent
e299f6d27f
commit
9f8b88ac15
@ -34,11 +34,19 @@ class TumblrIE(InfoExtractor):
|
|||||||
video_url = video.group('video_url')
|
video_url = video.group('video_url')
|
||||||
ext = video.group('ext')
|
ext = video.group('ext')
|
||||||
|
|
||||||
video_thumbnail = self._search_regex(
|
# retrieve all available thumbnails
|
||||||
r'posters.*?\[\\x22(.*?)\\x22',
|
thumb_list = []
|
||||||
webpage, 'thumbnail', fatal=False) # We pick the first poster
|
ma = re.search(r'posters.*?\[(?P<thumb>\\x22.*?\\x22)]', webpage)
|
||||||
if video_thumbnail:
|
if not ma is None:
|
||||||
video_thumbnail = video_thumbnail.replace('\\\\/', '/')
|
for t in ma.group('thumb').replace('\\\\/', '/').split(','):
|
||||||
|
t = t.replace('\\x22','"')
|
||||||
|
if (t[0]=='"') and (t[-1]=='"'):
|
||||||
|
thumb_list.append(t[1:-1])
|
||||||
|
|
||||||
|
# take the first, if user only wants one
|
||||||
|
single_thumb = None
|
||||||
|
if len(thumb_list)>0:
|
||||||
|
single_thumb = thumb_list[0]
|
||||||
|
|
||||||
# The only place where you can get a title, it's not complete,
|
# The only place where you can get a title, it's not complete,
|
||||||
# but searching in other places doesn't work for all videos
|
# but searching in other places doesn't work for all videos
|
||||||
@ -48,6 +56,7 @@ class TumblrIE(InfoExtractor):
|
|||||||
return [{'id': video_id,
|
return [{'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
'thumbnail': video_thumbnail,
|
'thumbnails': thumb_list,
|
||||||
|
'thumbnail': single_thumb,
|
||||||
'ext': ext
|
'ext': ext
|
||||||
}]
|
}]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user