aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorozburo <hq@ozburo.com>2020-12-22 06:12:14 -0600
committerSergey M․ <dstftw@gmail.com>2020-12-31 05:07:51 +0700
commitd1d0612160ed2d753cc57b30483776b7c1b03473 (patch)
tree7d28f46ce69ec2e63d5b5cb871f3ee877ebdda5a
parent7b0f04ed1f72fd4e4b5b3e935e08a912857fa8c4 (diff)
downloadyoutube-dl-d1d0612160ed2d753cc57b30483776b7c1b03473.tar.xz
[redditr] Extract all thumbnails
-rw-r--r--youtube_dl/extractor/reddit.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/youtube_dl/extractor/reddit.py b/youtube_dl/extractor/reddit.py
index 3b2abb262..2d1a1fd99 100644
--- a/youtube_dl/extractor/reddit.py
+++ b/youtube_dl/extractor/reddit.py
@@ -9,6 +9,7 @@ from ..utils import (
float_or_none,
try_get,
url_or_none,
+ unescapeHTML,
)
@@ -118,11 +119,23 @@ class RedditRIE(InfoExtractor):
else:
age_limit = None
+ thumbnails = []
+ images = try_get(
+ data, lambda x: x['preview']['images'][0]['resolutions']) or []
+ for image in images:
+ url = url_or_none(unescapeHTML(image['url']))
+ if url is not None:
+ thumbnails.append({
+ 'url': url,
+ 'width': int_or_none(image['width']),
+ 'height': int_or_none(image['height']),
+ })
+
return {
'_type': 'url_transparent',
'url': video_url,
'title': data.get('title'),
- 'thumbnail': url_or_none(data.get('thumbnail')),
+ 'thumbnails': thumbnails,
'timestamp': float_or_none(data.get('created_utc')),
'uploader': data.get('author'),
'duration': int_or_none(try_get(