mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-11-13 13:05:13 +00:00
[ie/kika] Do not extract non-existent subtitles (#14813)
Authored by: InvalidUsernameException
This commit is contained in:
committed by
GitHub
parent
ee98be4ad7
commit
79f9232ffb
@@ -17,57 +17,60 @@ class KikaIE(InfoExtractor):
|
|||||||
_GEO_COUNTRIES = ['DE']
|
_GEO_COUNTRIES = ['DE']
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.kika.de/logo/videos/logo-vom-samstag-einunddreissig-august-zweitausendvierundzwanzig-100',
|
# Video without season/episode info
|
||||||
'md5': 'fbfc8da483719ef06f396e5e5b938c69',
|
'url': 'https://www.kika.de/logo/videos/logo-vom-dienstag-achtundzwanzig-oktober-zweitausendfuenfundzwanzig-100',
|
||||||
|
'md5': '4a9f6e0f9c6bfcc82394c294f186d6db',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'logo-vom-samstag-einunddreissig-august-zweitausendvierundzwanzig-100',
|
'id': 'logo-vom-dienstag-achtundzwanzig-oktober-zweitausendfuenfundzwanzig-100',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'upload_date': '20240831',
|
'title': 'logo! vom Dienstag, 28. Oktober 2025',
|
||||||
'timestamp': 1725126600,
|
'description': 'md5:4d28b92cef423bec99740ffaa3e7ec04',
|
||||||
'season_number': 2024,
|
'duration': 651,
|
||||||
'modified_date': '20240831',
|
'timestamp': 1761678000,
|
||||||
'episode': 'Episode 476',
|
'upload_date': '20251028',
|
||||||
'episode_number': 476,
|
'modified_timestamp': 1761682624,
|
||||||
'season': 'Season 2024',
|
'modified_date': '20251028',
|
||||||
'duration': 634,
|
|
||||||
'title': 'logo! vom Samstag, 31. August 2024',
|
|
||||||
'modified_timestamp': 1725129983,
|
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
|
# Video with season/episode info
|
||||||
|
# Also: Video with subtitles
|
||||||
'url': 'https://www.kika.de/kaltstart/videos/video92498',
|
'url': 'https://www.kika.de/kaltstart/videos/video92498',
|
||||||
'md5': '710ece827e5055094afeb474beacb7aa',
|
'md5': 'e58073070acb195906c55c4ad31dceb3',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'video92498',
|
'id': 'video92498',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': '7. Wo ist Leo?',
|
'title': '7. Wo ist Leo?',
|
||||||
'description': 'md5:fb48396a5b75068bcac1df74f1524920',
|
'description': 'md5:fb48396a5b75068bcac1df74f1524920',
|
||||||
'duration': 436,
|
'duration': 436,
|
||||||
|
'season': 'Season 1',
|
||||||
|
'season_number': 1,
|
||||||
|
'episode': 'Episode 7',
|
||||||
|
'episode_number': 7,
|
||||||
'timestamp': 1702926876,
|
'timestamp': 1702926876,
|
||||||
'upload_date': '20231218',
|
'upload_date': '20231218',
|
||||||
'episode_number': 7,
|
|
||||||
'modified_date': '20240319',
|
|
||||||
'modified_timestamp': 1710880610,
|
'modified_timestamp': 1710880610,
|
||||||
'episode': 'Episode 7',
|
'modified_date': '20240319',
|
||||||
'season_number': 1,
|
'subtitles': 'count:1',
|
||||||
'season': 'Season 1',
|
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.kika.de/bernd-das-brot/astrobrot/videos/video90088',
|
# Video without subtitles
|
||||||
'md5': 'ffd1b700d7de0a6616a1d08544c77294',
|
'url': 'https://www.kika.de/die-pfefferkoerner/videos/abgezogen-102',
|
||||||
|
'md5': '62e97961ce5343c19f0f330a1b6dd736',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'video90088',
|
'id': 'abgezogen-102',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'upload_date': '20221102',
|
'title': '1. Abgezogen',
|
||||||
'timestamp': 1667390580,
|
'description': 'md5:42d87963364391f9f8eba8affcb30bd2',
|
||||||
'duration': 197,
|
'duration': 1574,
|
||||||
'modified_timestamp': 1711093771,
|
|
||||||
'episode_number': 8,
|
|
||||||
'title': 'Es ist nicht leicht, ein Astrobrot zu sein',
|
|
||||||
'modified_date': '20240322',
|
|
||||||
'description': 'md5:d3641deaf1b5515a160788b2be4159a9',
|
|
||||||
'season_number': 1,
|
|
||||||
'episode': 'Episode 8',
|
|
||||||
'season': 'Season 1',
|
'season': 'Season 1',
|
||||||
|
'season_number': 1,
|
||||||
|
'episode': 'Episode 1',
|
||||||
|
'episode_number': 1,
|
||||||
|
'timestamp': 1735382700,
|
||||||
|
'upload_date': '20241228',
|
||||||
|
'modified_timestamp': 1757344051,
|
||||||
|
'modified_date': '20250908',
|
||||||
|
'subtitles': 'count:0',
|
||||||
},
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
@@ -78,16 +81,19 @@ class KikaIE(InfoExtractor):
|
|||||||
video_assets = self._download_json(doc['assets']['url'], video_id)
|
video_assets = self._download_json(doc['assets']['url'], video_id)
|
||||||
|
|
||||||
subtitles = {}
|
subtitles = {}
|
||||||
if ttml_resource := url_or_none(video_assets.get('videoSubtitle')):
|
# Subtitle API endpoints may be present in the JSON even if there are no subtitles.
|
||||||
subtitles['de'] = [{
|
# They then return HTTP 200 with invalid data. So we must check explicitly.
|
||||||
'url': ttml_resource,
|
if doc.get('hasSubtitle'):
|
||||||
'ext': 'ttml',
|
if ttml_resource := url_or_none(video_assets.get('videoSubtitle')):
|
||||||
}]
|
subtitles['de'] = [{
|
||||||
if webvtt_resource := url_or_none(video_assets.get('webvttUrl')):
|
'url': ttml_resource,
|
||||||
subtitles.setdefault('de', []).append({
|
'ext': 'ttml',
|
||||||
'url': webvtt_resource,
|
}]
|
||||||
'ext': 'vtt',
|
if webvtt_resource := url_or_none(video_assets.get('webvttUrl')):
|
||||||
})
|
subtitles.setdefault('de', []).append({
|
||||||
|
'url': webvtt_resource,
|
||||||
|
'ext': 'vtt',
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user