From 7fff49c91332e60c10e33ac3114433f3c2a6ff5a Mon Sep 17 00:00:00 2001 From: subrat-lima Date: Tue, 10 Sep 2024 14:13:33 +0530 Subject: [PATCH] [ie/spreaker] enhancement: added support for podcast and feed pages --- yt_dlp/extractor/_extractors.py | 2 ++ yt_dlp/extractor/spreaker.py | 41 ++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py index e7b162512f..a2a3eb1d16 100644 --- a/yt_dlp/extractor/_extractors.py +++ b/yt_dlp/extractor/_extractors.py @@ -1929,8 +1929,10 @@ SpotifyShowIE, ) from .spreaker import ( + SpreakerFeedPageIE, SpreakerIE, SpreakerPageIE, + SpreakerPodcastPageIE, SpreakerShowIE, SpreakerShowPageIE, ) diff --git a/yt_dlp/extractor/spreaker.py b/yt_dlp/extractor/spreaker.py index d1df45969b..8202f4a0eb 100644 --- a/yt_dlp/extractor/spreaker.py +++ b/yt_dlp/extractor/spreaker.py @@ -83,7 +83,9 @@ class SpreakerIE(InfoExtractor): 'view_count': int, 'like_count': int, 'comment_count': int, - 'series': 'Success With Music (SWM)', + 'series': 'Success With Music | SWM', + 'thumbnail': r're:https?://.*\.jpg', + 'creators': ['SWM'], }, }, { 'url': 'https://api.spreaker.com/download/episode/12534508/swm_ep15_how_to_market_your_music_part_2.mp3', @@ -102,6 +104,7 @@ def _real_extract(self, url): class SpreakerPageIE(InfoExtractor): + # NOTE:the sample test doesnt work, need to futher investigate _VALID_URL = r'https?://(?:www\.)?spreaker\.com/user/[^/]+/(?P[^/?#&]+)' _TESTS = [{ 'url': 'https://www.spreaker.com/user/9780658/swm-ep15-how-to-market-your-music-part-2', @@ -156,6 +159,8 @@ def _real_extract(self, url): class SpreakerShowPageIE(InfoExtractor): + # NOTE:the sample test doesnt work, need to futher investigate + # layout has changed _VALID_URL = r'https?://(?:www\.)?spreaker\.com/show/(?P[^/?#&]+)' _TESTS = [{ 'url': 'https://www.spreaker.com/show/success-with-music', @@ -170,3 +175,37 @@ def _real_extract(self, url): return self.url_result( f'https://api.spreaker.com/show/{show_id}', ie=SpreakerShowIE.ie_key(), video_id=show_id) + + +class SpreakerPodcastPageIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?spreaker\.com/podcast/[\w-]+--(?P[\d]{3,})' + _TESTS = [{ + 'url': 'https://www.spreaker.com/podcast/health-wealth--5918323', + 'info_dict': { + 'id': '5918323', + }, + 'playlist_mincount': 60, + }] + + def _real_extract(self, url): + show_id = self._match_id(url) + return self.url_result( + f'https://api.spreaker.com/show/{show_id}', + ie=SpreakerShowIE.ie_key(), video_id=show_id) + + +class SpreakerFeedPageIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?spreaker\.com/show/(?P[\d]+)/episodes/feed' + _TESTS = [{ + 'url': 'https://www.spreaker.com/show/5887186/episodes/feed', + 'info_dict': { + 'id': '5887186', + }, + 'playlist_mincount': 290, + }] + + def _real_extract(self, url): + show_id = self._match_id(url) + return self.url_result( + f'https://api.spreaker.com/show/{show_id}', + ie=SpreakerShowIE.ie_key(), video_id=show_id)