From 7439eb91551a5a433bfb801eb26fb842eafa587a Mon Sep 17 00:00:00 2001 From: Mariusz Skoneczko Date: Sat, 1 Feb 2020 14:06:29 +1100 Subject: [PATCH] [AnimeLab] Extract all thumbnails --- youtube_dl/extractor/animelab.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/youtube_dl/extractor/animelab.py b/youtube_dl/extractor/animelab.py index 637ca2b5f..58c3e2ec8 100644 --- a/youtube_dl/extractor/animelab.py +++ b/youtube_dl/extractor/animelab.py @@ -126,17 +126,16 @@ class AnimeLabIE(AnimeLabBaseIE): duration = int_or_none(raw_data.get('duration')) thumbnail_data = raw_data.get('images', []) - thumbnail_data = thumbnail_data[0] if len(thumbnail_data) > 0 else None - if thumbnail_data is not None: - image_data = thumbnail_data.get('imageInfo', {}) - thumbnails = [{ - 'id': str_or_none(thumbnail_data.get('id')), - 'url': image_data.get('fullPath'), - 'width': image_data.get('width'), - 'height': image_data.get('height'), - }] - else: - thumbnails = None + thumbnails = [] + for thumbnail in thumbnail_data: + for instance in thumbnail['imageInstances']: + image_data = instance.get('imageInfo', {}) + thumbnails.append({ + 'id': str_or_none(image_data.get('id')), + 'url': image_data.get('fullPath'), + 'width': image_data.get('width'), + 'height': image_data.get('height'), + }) season_data = raw_data.get('season', {}) season = str_or_none(season_data.get('name'))