From 9d47ffa645cd5e36402925669d87a5c5f7e6b989 Mon Sep 17 00:00:00 2001 From: garret Date: Tue, 6 Aug 2024 11:16:00 +0100 Subject: split mobile extraction into a separate func to use elsewhere --- yt_dlp_plugins/extractor/radiko_mobile.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/yt_dlp_plugins/extractor/radiko_mobile.py b/yt_dlp_plugins/extractor/radiko_mobile.py index fc19cb4..8bfb163 100644 --- a/yt_dlp_plugins/extractor/radiko_mobile.py +++ b/yt_dlp_plugins/extractor/radiko_mobile.py @@ -93,11 +93,8 @@ class RadikoMobileEventIE(_RadikoMobileBaseIE): "_old_archive_ids": [join_nonempty(program.get("stationId"), old_timestring)], } - def _real_extract(self, url): - event_id = self._match_id(url) - pageProps, _ = self._get_nextjs_data(url, event_id) - - meta = self._get_programme_meta(pageProps.get("program"), pageProps.get("actors")) + def _extract_episode(self, program, actors=None): + meta = self._get_programme_meta(program, actors) station = meta.get("channel_id") start = rtime.RadikoTime.fromtimestamp(meta.get("timestamp"), tz=rtime.JST) end = rtime.RadikoTime.fromtimestamp(meta.get("release_timestamp"), tz=rtime.JST) @@ -114,3 +111,8 @@ class RadikoMobileEventIE(_RadikoMobileBaseIE): "live_status": "was_live", "container": "m4a_dash", # force fixup, AAC-only HLS } + + def _real_extract(self, url): + event_id = self._match_id(url) + pageProps, data = self._get_nextjs_data(url, event_id) + return self._extract_episode(pageProps.get("program"), pageProps.get("actors")) -- cgit v1.2.3-70-g09d2