From 17a23f0930e8012bec4e7c3619e0bfc484481971 Mon Sep 17 00:00:00 2001 From: Misael Aguayo Date: Sun, 10 Jul 2022 14:22:30 -0500 Subject: [PATCH] [extractor/syvdk] Add extractor (#4250) Closes https://github.com/yt-dlp/yt-dlp/issues/4077 Authored by: misaelaguayo --- yt_dlp/extractor/_extractors.py | 1 + yt_dlp/extractor/syvdk.py | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 yt_dlp/extractor/syvdk.py diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py index 2a83c28540..70c5565d97 100644 --- a/yt_dlp/extractor/_extractors.py +++ b/yt_dlp/extractor/_extractors.py @@ -1670,6 +1670,7 @@ SVTSeriesIE, ) from .swrmediathek import SWRMediathekIE +from .syvdk import SYVDKIE from .syfy import SyfyIE from .sztvhu import SztvHuIE from .tagesschau import TagesschauIE diff --git a/yt_dlp/extractor/syvdk.py b/yt_dlp/extractor/syvdk.py new file mode 100644 index 0000000000..287fb264b7 --- /dev/null +++ b/yt_dlp/extractor/syvdk.py @@ -0,0 +1,33 @@ +from .common import InfoExtractor +from ..utils import traverse_obj + + +class SYVDKIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P[\w-]+)' + + _TESTS = [{ + 'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2', + 'md5': '429ce5a423dd4b1e1d0bf3a569558089', + 'info_dict': { + 'id': '12215', + 'display_id': 'isabella-arendt-stiller-op-for-de-konservative-2', + 'ext': 'mp3', + 'title': 'Isabella Arendt stiller op for De Konservative', + 'description': 'md5:f5fa6a431813bf37284f3412ad7c6c06' + } + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + info_data = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['episodeDetails'][0] + + return { + 'id': str(info_data['id']), + 'vcodec': 'none', + 'ext': 'mp3', + 'url': info_data['details']['enclosure'], + 'display_id': video_id, + 'title': traverse_obj(info_data, ('title', 'rendered')), + 'description': traverse_obj(info_data, ('details', 'post_title')), + }