mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-07-03 08:49:02 +00:00
[ie/arte] Fix playlist support (#13191)
Closes #2945 Authored by: 1100101
This commit is contained in:
parent
8b8e3e3cb4
commit
16bdcc525e
@ -293,33 +293,79 @@ class ArteTVPlaylistIE(ArteTVBaseIE):
|
|||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.arte.tv/pl/videos/RC-014123/arte-reportage/',
|
'url': 'https://www.arte.tv/pl/videos/RC-014123/arte-reportage/',
|
||||||
'playlist_mincount': 100,
|
'playlist_mincount': 20,
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'description': 'md5:84e7bf1feda248bc325ebfac818c476e',
|
'description': 'md5:84e7bf1feda248bc325ebfac818c476e',
|
||||||
'id': 'RC-014123',
|
'id': 'RC-014123',
|
||||||
'title': 'ARTE Reportage - najlepsze reportaże',
|
'title': 'ARTE Reportage',
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.arte.tv/de/videos/RC-027513/twin-peaks/',
|
||||||
|
'playlist_mincount': 48,
|
||||||
|
'info_dict': {
|
||||||
|
'description': 'md5:4a99f0339d76e4a11a6ad751234d2398',
|
||||||
|
'id': 'RC-027513',
|
||||||
|
'title': 'Twin Peaks',
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.arte.tv/de/videos/RC-027683/unterschaetzt-die-rechte-terrorgefahr/',
|
||||||
|
'playlist_mincount': 2,
|
||||||
|
'info_dict': {
|
||||||
|
'description': 'md5:910dc74d146fd9a12f62ec0d5495c700',
|
||||||
|
'id': 'RC-027683',
|
||||||
|
'title': 'Unterschätzt - Die rechte Terrorgefahr',
|
||||||
},
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
_API_TOKEN = 'Nzc1Yjc1ZjJkYjk1NWFhN2I2MWEwMmRlMzAzNjI5NmU3NWU3ODg4ODJjOWMxNTMxYzEzZGRjYjg2ZGE4MmIwOA'
|
||||||
|
|
||||||
|
def _season_entries(self, season_ids, lang):
|
||||||
|
for season_id in season_ids:
|
||||||
|
season_data = self._download_json(
|
||||||
|
f'{self._API_BASE}/playlist/{lang}/{season_id}', season_id,
|
||||||
|
headers={'x-validated-age': '18'})
|
||||||
|
|
||||||
|
for video in traverse_obj(season_data, (
|
||||||
|
'data', 'attributes', 'items',
|
||||||
|
lambda _, v: v['providerId'] and v['link']['url'])):
|
||||||
|
yield {
|
||||||
|
'_type': 'url_transparent',
|
||||||
|
'ie_key': ArteTVIE.ie_key(),
|
||||||
|
**traverse_obj(video, {
|
||||||
|
'url': ('link', 'url', {str}),
|
||||||
|
'id': ('providerId', {str}),
|
||||||
|
'title': ('title', {str}),
|
||||||
|
'alt_title': ('subtitle', {str}),
|
||||||
|
'duration': ('duration', 'seconds', {int_or_none}),
|
||||||
|
'age_limit': ('ageRating', {int_or_none}),
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
lang, playlist_id = self._match_valid_url(url).group('lang', 'id')
|
lang, playlist_id = self._match_valid_url(url).group('lang', 'id')
|
||||||
playlist = self._download_json(
|
|
||||||
f'{self._API_BASE}/playlist/{lang}/{playlist_id}', playlist_id)['data']['attributes']
|
|
||||||
|
|
||||||
entries = [{
|
playlist_info = traverse_obj(self._download_json(
|
||||||
'_type': 'url_transparent',
|
f'https://api.arte.tv/api/opa/v3/programs/{lang}/{playlist_id}', playlist_id,
|
||||||
'url': video['config']['url'],
|
headers={'Authorization': f'Bearer {self._API_TOKEN}'}), ('programs', ..., {dict}, any))
|
||||||
'ie_key': ArteTVIE.ie_key(),
|
|
||||||
'id': video.get('providerId'),
|
|
||||||
'title': video.get('title'),
|
|
||||||
'alt_title': video.get('subtitle'),
|
|
||||||
'thumbnail': url_or_none(traverse_obj(video, ('mainImage', 'url'))),
|
|
||||||
'duration': int_or_none(traverse_obj(video, ('duration', 'seconds'))),
|
|
||||||
} for video in traverse_obj(playlist, ('items', lambda _, v: v['config']['url']))]
|
|
||||||
|
|
||||||
return self.playlist_result(entries, playlist_id,
|
metadata = traverse_obj(playlist_info, {
|
||||||
traverse_obj(playlist, ('metadata', 'title')),
|
'title': ('title', {str}),
|
||||||
traverse_obj(playlist, ('metadata', 'description')))
|
'description': ('shortDescription', {str}),
|
||||||
|
})
|
||||||
|
|
||||||
|
# Check first if there are seasons
|
||||||
|
season_ids = traverse_obj(
|
||||||
|
playlist_info, ('children', (lambda _, v: v['catalogType'] == 'SEASON'), 'programId'))
|
||||||
|
if season_ids:
|
||||||
|
return self.playlist_result(
|
||||||
|
self._season_entries(season_ids, lang), playlist_id, **metadata)
|
||||||
|
|
||||||
|
# It might be a mini series comprised of a few shows
|
||||||
|
shows = traverse_obj(playlist_info, (
|
||||||
|
'videos', lambda _, v: v['kind'] == 'SHOW' and url_or_none(v['url'])))
|
||||||
|
return self.playlist_result(
|
||||||
|
[self.url_result(show['url'], ArteTVIE) for show in shows],
|
||||||
|
playlist_id, **metadata)
|
||||||
|
|
||||||
|
|
||||||
class ArteTVCategoryIE(ArteTVBaseIE):
|
class ArteTVCategoryIE(ArteTVBaseIE):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user