From 9d5e117c16b6616df795995158de165358b28c68 Mon Sep 17 00:00:00 2001 From: Elliot Algase Date: Wed, 15 May 2019 22:04:02 -0400 Subject: [PATCH] [narando] extract thumbnails --- youtube_dl/extractor/narando.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/narando.py b/youtube_dl/extractor/narando.py index 8f8fa0cdd..c250cc997 100644 --- a/youtube_dl/extractor/narando.py +++ b/youtube_dl/extractor/narando.py @@ -6,6 +6,7 @@ from .common import InfoExtractor class NarandoIE(InfoExtractor): IE_NAME = 'narando' + _THUMB_SIZES = ('small', 'square', 'medium', 'big', 'original') _VALID_URL = r'https?://narando\.com/widget\?.*?r=(?P\w+)&?' _TEST = { 'url': 'https://narando.com/widget?r=b2t4t789kxgy9g7ms4rwjvvw', @@ -22,11 +23,22 @@ class NarandoIE(InfoExtractor): webpage = self._download_webpage(url, video_id) title = self._html_search_regex(r'(.+?)', webpage, 'title') download_url = self._html_search_regex(r'
(.+)
', webpage, 'download_url') + thumbnail_id = self._html_search_regex(r'article_picture\/(.+?)\/small\.jpg', webpage, 'thumbnail_id', fatal=False) + thumbnail_dict = [] + thumb_id = 0 + for size in self._THUMB_SIZES: + thumbnail_dict.append({ + 'url': 'https://static.narando.com/article_picture/' + thumbnail_id + '/' + size + '.jpg', + 'id': size, + 'preference': thumb_id, + }) + thumb_id += 1 return { 'id': video_id, 'title': title, 'url': download_url, 'vcodec': 'none', + 'thumbnails': thumbnail_dict, } @@ -44,7 +56,7 @@ class NarandoArticleIE(InfoExtractor): } }, { - 'url': 'https://narando.com/r/b2t4t789kxgy9g7ms4rwjvvw', #alternate URL format + 'url': 'https://narando.com/r/b2t4t789kxgy9g7ms4rwjvvw', # alternate URL format 'md5': 'd20f671f0395bab8f8285d1f6e8f965e', 'info_dict': { 'id': 'b2t4t789kxgy9g7ms4rwjvvw',