diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2015-01-25 02:38:47 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2015-01-25 02:43:19 +0100 |
commit | cfb56d1af38f3e1e0251dbd8a20e3ed8884976ff (patch) | |
tree | f6a2d49083150cc057649c1f923c510a8acd0be1 /youtube_dl/extractor/testtube.py | |
parent | 1e108029907ca28b75f37d2cf0bf25bcabbfbdac (diff) |
Add --list-thumbnails
Diffstat (limited to 'youtube_dl/extractor/testtube.py')
-rw-r--r-- | youtube_dl/extractor/testtube.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/youtube_dl/extractor/testtube.py b/youtube_dl/extractor/testtube.py index fd47e71a2..6a7b5e49d 100644 --- a/youtube_dl/extractor/testtube.py +++ b/youtube_dl/extractor/testtube.py @@ -1,7 +1,10 @@ from __future__ import unicode_literals from .common import InfoExtractor -from ..utils import int_or_none +from ..utils import ( + int_or_none, + qualities, +) class TestTubeIE(InfoExtractor): @@ -46,13 +49,22 @@ class TestTubeIE(InfoExtractor): self._sort_formats(formats) duration = int_or_none(info.get('duration')) + images = info.get('images') + thumbnails = None + preference = qualities(['mini', 'small', 'medium', 'large']) + if images: + thumbnails = [{ + 'id': thumbnail_id, + 'url': img_url, + 'preference': preference(thumbnail_id) + } for thumbnail_id, img_url in images.items()] return { 'id': video_id, 'display_id': display_id, 'title': info['title'], 'description': info.get('summary'), - 'thumbnail': info.get('images', {}).get('large'), + 'thumbnails': thumbnails, 'uploader': info.get('show', {}).get('name'), 'uploader_id': info.get('show', {}).get('slug'), 'duration': duration, |