diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-05 09:06:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-05 09:06:10 +0000 |
commit | 7e21328585afda6d66f98ca476301680eeffac32 (patch) | |
tree | 266a4e7b20443f94572748781d71fc0375a15037 /yt_dlp/extractor/imgur.py | |
parent | Adding upstream version 2024.05.27. (diff) | |
download | yt-dlp-7e21328585afda6d66f98ca476301680eeffac32.tar.xz yt-dlp-7e21328585afda6d66f98ca476301680eeffac32.zip |
Adding upstream version 2024.07.01.upstream/2024.07.01
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | yt_dlp/extractor/imgur.py | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/yt_dlp/extractor/imgur.py b/yt_dlp/extractor/imgur.py index f32c116..f0c3419 100644 --- a/yt_dlp/extractor/imgur.py +++ b/yt_dlp/extractor/imgur.py @@ -228,21 +228,18 @@ class ImgurGalleryBaseIE(ImgurBaseIE): if traverse_obj(data, 'is_album'): - def yield_media_ids(): - for m_id in traverse_obj(data, ( - 'media', lambda _, v: v.get('type') == 'video' or v['metadata']['is_animated'], - 'id', {lambda x: str_or_none(x) or None})): - yield m_id + items = traverse_obj(data, ( + 'media', lambda _, v: v.get('type') == 'video' or v['metadata']['is_animated'], + 'id', {lambda x: str_or_none(x) or None})) # if a gallery with exactly one video, apply album metadata to video - media_id = ( - self._GALLERY - and traverse_obj(data, ('image_count', {lambda c: c == 1})) - and next(yield_media_ids(), None)) + media_id = None + if self._GALLERY and len(items) == 1: + media_id = items[0] if not media_id: result = self.playlist_result( - map(self._imgur_result, yield_media_ids()), gallery_id) + map(self._imgur_result, items), gallery_id) result.update(info) return result gallery_id = media_id @@ -372,13 +369,13 @@ class ImgurAlbumIE(ImgurGalleryBaseIE): 'url': 'https://imgur.com/a/iX265HX', 'info_dict': { 'id': 'iX265HX', - 'title': 'enen-no-shouboutai' + 'title': 'enen-no-shouboutai', }, 'playlist_count': 2, }, { 'url': 'https://imgur.com/a/8pih2Ed', 'info_dict': { - 'id': '8pih2Ed' + 'id': '8pih2Ed', }, 'playlist_mincount': 1, }] |