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')
|
||||
ext = video.group('ext')
|
||||
|
||||
video_thumbnail = self._search_regex(
|
||||
r'posters.*?\[\\x22(.*?)\\x22',
|
||||
webpage, 'thumbnail', fatal=False) # We pick the first poster
|
||||
if video_thumbnail:
|
||||
video_thumbnail = video_thumbnail.replace('\\\\/', '/')
|
||||
# retrieve all available thumbnails
|
||||
thumb_list = []
|
||||
ma = re.search(r'posters.*?\[(?P<thumb>\\x22.*?\\x22)]', webpage)
|
||||
if not ma is None:
|
||||
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,
|
||||
# but searching in other places doesn't work for all videos
|
||||
@ -48,6 +56,7 @@ class TumblrIE(InfoExtractor):
|
||||
return [{'id': video_id,
|
||||
'url': video_url,
|
||||
'title': video_title,
|
||||
'thumbnail': video_thumbnail,
|
||||
'thumbnails': thumb_list,
|
||||
'thumbnail': single_thumb,
|
||||
'ext': ext
|
||||
}]
|
||||
|
Loading…
x
Reference in New Issue
Block a user