]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/syvdk.py
[ie/orf:on] Improve extraction (#9677)
[yt-dlp.git] / yt_dlp / extractor / syvdk.py
CommitLineData
17a23f09
MA
1from .common import InfoExtractor
2from ..utils import traverse_obj
3
4
5class SYVDKIE(InfoExtractor):
6 _VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[\w-]+)'
7
8 _TESTS = [{
9 'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
10 'md5': '429ce5a423dd4b1e1d0bf3a569558089',
11 'info_dict': {
12 'id': '12215',
13 'display_id': 'isabella-arendt-stiller-op-for-de-konservative-2',
14 'ext': 'mp3',
15 'title': 'Isabella Arendt stiller op for De Konservative',
16 'description': 'md5:f5fa6a431813bf37284f3412ad7c6c06'
17 }
18 }]
19
20 def _real_extract(self, url):
21 video_id = self._match_id(url)
22 webpage = self._download_webpage(url, video_id)
23 info_data = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['episodeDetails'][0]
24
25 return {
26 'id': str(info_data['id']),
27 'vcodec': 'none',
28 'ext': 'mp3',
29 'url': info_data['details']['enclosure'],
30 'display_id': video_id,
31 'title': traverse_obj(info_data, ('title', 'rendered')),
32 'description': traverse_obj(info_data, ('details', 'post_title')),
33 }