mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-09-13 22:44:32 +03:00
Apply suggested fixes.
Changed the testcase to a different show, as the previous one kept "losing" episodes.
This commit is contained in:
@@ -960,7 +960,10 @@ from .kick import (
|
|||||||
)
|
)
|
||||||
from .kicker import KickerIE
|
from .kicker import KickerIE
|
||||||
from .kickstarter import KickStarterIE
|
from .kickstarter import KickStarterIE
|
||||||
from .kika import KikaIE, KikaPlaylistIE
|
from .kika import (
|
||||||
|
KikaIE,
|
||||||
|
KikaPlaylistIE,
|
||||||
|
)
|
||||||
from .kinja import KinjaEmbedIE
|
from .kinja import KinjaEmbedIE
|
||||||
from .kinopoisk import KinoPoiskIE
|
from .kinopoisk import KinoPoiskIE
|
||||||
from .kommunetv import KommunetvIE
|
from .kommunetv import KommunetvIE
|
||||||
|
|||||||
+24
-28
@@ -131,38 +131,34 @@ class KikaPlaylistIE(InfoExtractor):
|
|||||||
_GEO_COUNTRIES = ['DE']
|
_GEO_COUNTRIES = ['DE']
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.kika.de/marcus-level/marcus-level-102',
|
'url': 'https://www.kika.de/logo/logo-die-welt-und-ich-562',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'marcus-level-102',
|
'id': 'logo-die-welt-und-ich-562',
|
||||||
'title': 'Marcus Level',
|
'title': 'logo!',
|
||||||
'description': 'Marcus bekommt die neue Version seines Lieblingsvideospiels: '
|
'description': 'md5:7b9d7f65561b82fa512f2cfb553c397d',
|
||||||
'"Gorbar and the Valley of the Seven Light Towers". Als er die Spielkonsole anschaltet, '
|
|
||||||
'schießt ein greller, weißer Lichtstrahl aus dem Bildschirm. Marcus befindet sich plötzlich '
|
|
||||||
'im Videospiel in der Rolle seines Lieblingshelden "Gorbar the Magnificent". Sowohl Marcus, '
|
|
||||||
'als auch Gorbar, der sich nun in Marcus\' Zuhause befindet, stehen beide vor großen Herausforderungen.',
|
|
||||||
},
|
},
|
||||||
'playlist_count': 35,
|
'playlist_count': 100,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
def _entries(self, playlist_url, playlist_id):
|
||||||
|
while playlist_url:
|
||||||
|
data = self._download_json(playlist_url, playlist_id)
|
||||||
|
for item in traverse_obj(data, ('content', lambda _, v: url_or_none(v['api']['url']))):
|
||||||
|
yield self.url_result(
|
||||||
|
item['api']['url'], ie=KikaIE,
|
||||||
|
**traverse_obj(item, {
|
||||||
|
'id': ('id', {str}),
|
||||||
|
'title': ('title', {str}),
|
||||||
|
'duration': ('duration', {int_or_none}),
|
||||||
|
'timestamp': ('date', {parse_iso8601}),
|
||||||
|
}))
|
||||||
|
# This becomes 'None' when reaching the last page
|
||||||
|
playlist_url = traverse_obj(data, ('links', 'next', {url_or_none}))
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
def fetch_page(playlist_url):
|
playlist_id = self._match_id(url)
|
||||||
while playlist_url:
|
brand_data = self._download_json(
|
||||||
data = self._download_json(playlist_url, playlist_id)
|
f'https://www.kika.de/_next-api/proxy/v1/brands/{playlist_id}', playlist_id)
|
||||||
for item in traverse_obj(data, ('content', ..., {dict})):
|
|
||||||
yield self.url_result(
|
|
||||||
item['api']['url'],
|
|
||||||
ie=KikaIE,
|
|
||||||
**traverse_obj(item, {
|
|
||||||
'id': ('id', {str}),
|
|
||||||
'title': ('title', {str}),
|
|
||||||
'duration': ('duration', {int_or_none}),
|
|
||||||
'timestamp': ('date', {parse_iso8601}),
|
|
||||||
}))
|
|
||||||
# This becomes 'None' when reaching the last page
|
|
||||||
playlist_url = data['links']['next']
|
|
||||||
|
|
||||||
playlist_id = self._match_valid_url(url).group('id')
|
return self.playlist_result(self._entries(brand_data['videoSubchannel']['videosPageUrl'], playlist_id),
|
||||||
brand_data = self._download_json(f'https://www.kika.de/_next-api/proxy/v1/brands/{playlist_id}', playlist_id)
|
|
||||||
|
|
||||||
return self.playlist_result(fetch_page(brand_data['videoSubchannel']['videosPageUrl']),
|
|
||||||
playlist_id, title=brand_data.get('title'), description=brand_data.get('description'))
|
playlist_id, title=brand_data.get('title'), description=brand_data.get('description'))
|
||||||
|
|||||||
Reference in New Issue
Block a user