aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbashonly <bashonly@protonmail.com>2024-11-14 16:09:11 -0600
committerbashonly <88596187+bashonly@users.noreply.github.com>2024-11-15 22:51:55 +0000
commitc699bafc5038b59c9afe8c2e69175fb66424c832 (patch)
tree07a8fa2f5490a62e1e76f48085328b13b5d97769
parenteb64ae7d5def6df2aba74fb703e7f168fb299865 (diff)
[ie/soop] Fix thumbnail extraction (#11545)
Closes #11537 Authored by: bashonly
-rw-r--r--yt_dlp/extractor/afreecatv.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/yt_dlp/extractor/afreecatv.py b/yt_dlp/extractor/afreecatv.py
index 6682a8981..572d1a389 100644
--- a/yt_dlp/extractor/afreecatv.py
+++ b/yt_dlp/extractor/afreecatv.py
@@ -66,6 +66,14 @@ class AfreecaTVBaseIE(InfoExtractor):
extensions={'legacy_ssl': True}), display_id,
'Downloading API JSON', 'Unable to download API JSON')
+ @staticmethod
+ def _fixup_thumb(thumb_url):
+ if not url_or_none(thumb_url):
+ return None
+ # Core would determine_ext as 'php' from the url, so we need to provide the real ext
+ # See: https://github.com/yt-dlp/yt-dlp/issues/11537
+ return [{'url': thumb_url, 'ext': 'jpg'}]
+
class AfreecaTVIE(AfreecaTVBaseIE):
IE_NAME = 'soop'
@@ -155,7 +163,7 @@ class AfreecaTVIE(AfreecaTVBaseIE):
'uploader': ('writer_nick', {str}),
'uploader_id': ('bj_id', {str}),
'duration': ('total_file_duration', {int_or_none(scale=1000)}),
- 'thumbnail': ('thumb', {url_or_none}),
+ 'thumbnails': ('thumb', {self._fixup_thumb}),
})
entries = []
@@ -226,8 +234,7 @@ class AfreecaTVCatchStoryIE(AfreecaTVBaseIE):
return self.playlist_result(self._entries(data), video_id)
- @staticmethod
- def _entries(data):
+ def _entries(self, data):
# 'files' is always a list with 1 element
yield from traverse_obj(data, (
'data', lambda _, v: v['story_type'] == 'catch',
@@ -238,7 +245,7 @@ class AfreecaTVCatchStoryIE(AfreecaTVBaseIE):
'title': ('title', {str}),
'uploader': ('writer_nick', {str}),
'uploader_id': ('writer_id', {str}),
- 'thumbnail': ('thumb', {url_or_none}),
+ 'thumbnails': ('thumb', {self._fixup_thumb}),
'timestamp': ('write_timestamp', {int_or_none}),
}))