A feature-rich command-line audio/video downloader
[ie/SaucePlusChannel] Add extractor (#15830)
Parker Wahle97f03660f556
diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.pyindex b604754274..cc25fc9b03 100644--- a/yt_dlp/extractor/_extractors.py+++ b/yt_dlp/extractor/_extractors.py@@ -1792,7 +1792,10 @@ from .safari import (from .saitosan import SaitosanIEfrom .samplefocus import SampleFocusIEfrom .sapo import SapoIE-from .sauceplus import SaucePlusIE+from .sauceplus import (+ SaucePlusChannelIE,+ SaucePlusIE,+)from .sbs import SBSIEfrom .sbscokr import (SBSCoKrAllvodProgramIE,diff --git a/yt_dlp/extractor/floatplane.py b/yt_dlp/extractor/floatplane.pyindex 31723c232f..3c24c6aa2a 100644--- a/yt_dlp/extractor/floatplane.py+++ b/yt_dlp/extractor/floatplane.py@@ -318,34 +318,8 @@ class FloatplaneIE(FloatplaneBaseIE):self.raise_login_required()-class FloatplaneChannelIE(InfoExtractor):- _VALID_URL = r'https?://(?:(?:www|beta)\.)?floatplane\.com/channel/(?P<id>[\w-]+)/home(?:/(?P<channel>[\w-]+))?'- _PAGE_SIZE = 20- _TESTS = [{- 'url': 'https://www.floatplane.com/channel/linustechtips/home/ltxexpo',- 'info_dict': {- 'id': 'linustechtips/ltxexpo',- 'title': 'LTX Expo',- 'description': 'md5:9819002f9ebe7fd7c75a3a1d38a59149',- },- 'playlist_mincount': 51,- }, {- 'url': 'https://www.floatplane.com/channel/ShankMods/home',- 'info_dict': {- 'id': 'ShankMods',- 'title': 'Shank Mods',- 'description': 'md5:6dff1bb07cad8e5448e04daad9be1b30',- },- 'playlist_mincount': 14,- }, {- 'url': 'https://beta.floatplane.com/channel/bitwit_ultra/home',- 'info_dict': {- 'id': 'bitwit_ultra',- 'title': 'Bitwit Ultra',- 'description': 'md5:1452f280bb45962976d4789200f676dd',- },- 'playlist_mincount': 200,- }]+class FloatplaneChannelBaseIE(InfoExtractor):+ """Subclasses must set _RESULT_IE, _BASE_URL and _PAGE_SIZE"""def _fetch_page(self, display_id, creator_id, channel_id, page):query = {@@ -356,12 +330,12 @@ class FloatplaneChannelIE(InfoExtractor):if channel_id:query['channel'] = channel_idpage_data = self._download_json(- 'https://www.floatplane.com/api/v3/content/creator', display_id,+ f'{self._BASE_URL}/api/v3/content/creator', display_id,query=query, note=f'Downloading page {page + 1}')for post in page_data or []:yield self.url_result(- f'https://www.floatplane.com/post/{post["id"]}',- FloatplaneIE, id=post['id'], title=post.get('title'),+ f'{self._BASE_URL}/post/{post["id"]}',+ self._RESULT_IE, id=post['id'], title=post.get('title'),release_timestamp=parse_iso8601(post.get('releaseDate')))def _real_extract(self, url):@@ -369,7 +343,7 @@ class FloatplaneChannelIE(InfoExtractor):display_id = join_nonempty(creator, channel, delim='/')creator_data = self._download_json(- 'https://www.floatplane.com/api/v3/creator/named',+ f'{self._BASE_URL}/api/v3/creator/named',display_id, query={'creatorURL[0]': creator})[0]channel_data = traverse_obj(@@ -379,3 +353,35 @@ class FloatplaneChannelIE(InfoExtractor):self._fetch_page, display_id, creator_data['id'], channel_data.get('id')), self._PAGE_SIZE),display_id, title=channel_data.get('title') or creator_data.get('title'),description=channel_data.get('about') or creator_data.get('about'))+++class FloatplaneChannelIE(FloatplaneChannelBaseIE):+ _VALID_URL = r'https?://(?:(?:www|beta)\.)?floatplane\.com/channel/(?P<id>[\w-]+)/home(?:/(?P<channel>[\w-]+))?'+ _BASE_URL = 'https://www.floatplane.com'+ _PAGE_SIZE = 20+ _RESULT_IE = FloatplaneIE+ _TESTS = [{+ 'url': 'https://www.floatplane.com/channel/linustechtips/home/ltxexpo',+ 'info_dict': {+ 'id': 'linustechtips/ltxexpo',+ 'title': 'LTX Expo',+ 'description': 'md5:9819002f9ebe7fd7c75a3a1d38a59149',+ },+ 'playlist_mincount': 51,+ }, {+ 'url': 'https://www.floatplane.com/channel/ShankMods/home',+ 'info_dict': {+ 'id': 'ShankMods',+ 'title': 'Shank Mods',+ 'description': 'md5:6dff1bb07cad8e5448e04daad9be1b30',+ },+ 'playlist_mincount': 14,+ }, {+ 'url': 'https://beta.floatplane.com/channel/bitwit_ultra/home',+ 'info_dict': {+ 'id': 'bitwit_ultra',+ 'title': 'Bitwit Ultra',+ 'description': 'md5:1452f280bb45962976d4789200f676dd',+ },+ 'playlist_mincount': 200,+ }]diff --git a/yt_dlp/extractor/sauceplus.py b/yt_dlp/extractor/sauceplus.pyindex 75d7022d3c..e0041a7355 100644--- a/yt_dlp/extractor/sauceplus.py+++ b/yt_dlp/extractor/sauceplus.py@@ -1,4 +1,4 @@-from .floatplane import FloatplaneBaseIE+from .floatplane import FloatplaneBaseIE, FloatplaneChannelBaseIEclass SaucePlusIE(FloatplaneBaseIE):@@ -39,3 +39,19 @@ class SaucePlusIE(FloatplaneBaseIE):def _real_initialize(self):if not self._get_cookies(self._BASE_URL).get('__Host-sp-sess'):self.raise_login_required()+++class SaucePlusChannelIE(FloatplaneChannelBaseIE):+ _VALID_URL = r'https?://(?:(?:www|beta)\.)?sauceplus\.com/channel/(?P<id>[\w-]+)/home(?:/(?P<channel>[\w-]+))?'+ _BASE_URL = 'https://www.sauceplus.com'+ _RESULT_IE = SaucePlusIE+ _PAGE_SIZE = 20+ _TESTS = [{+ 'url': 'https://www.sauceplus.com/channel/williamosman/home',+ 'info_dict': {+ 'id': 'williamosman',+ 'title': 'William Osman',+ 'description': 'md5:a67bc961d23c293b2c5308d84f34f26c',+ },+ 'playlist_mincount': 158,+ }]