From 64faaf01a2b23a4d8c2a70067b827a07089b610c Mon Sep 17 00:00:00 2001 From: Hawker2 <59458605+Hawker2@users.noreply.github.com> Date: Mon, 19 Aug 2024 16:32:45 -0500 Subject: [PATCH 1/2] [extractor/spankbang] Add support for spankbang.party (yt-dlp#6545) Update URL match to support both '.com' and '.party'. Modify metadata request to use the domain of the supplied URL rather than hardcoded 'spankbang.com'. --- yt_dlp/extractor/spankbang.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/yt_dlp/extractor/spankbang.py b/yt_dlp/extractor/spankbang.py index 6805a72de..1661feef3 100644 --- a/yt_dlp/extractor/spankbang.py +++ b/yt_dlp/extractor/spankbang.py @@ -17,7 +17,7 @@ class SpankBangIE(InfoExtractor): _VALID_URL = r'''(?x) https?:// - (?:[^/]+\.)?spankbang\.com/ + (?:[^/]+\.)?spankbang\.(?:com|party)/ (?: (?P[\da-z]+)/(?:video|play|embed)\b| [\da-z]+-(?P[\da-z]+)/playlist/[^/?#&]+ @@ -111,9 +111,10 @@ def extract_format(format_id, format_url): stream_key = self._search_regex( r'data-streamkey\s*=\s*(["\'])(?P(?:(?!\1).)+)\1', webpage, 'stream key', group='value') - + stream_domain = re.search(r'https?://(?:[^/]+\.)?(spankbang\.(?:com|party))/', url).group(1) + stream_url = 'https://' + stream_domain + '/api/videos/stream' stream = self._download_json( - 'https://spankbang.com/api/videos/stream', video_id, + stream_url, video_id, 'Downloading stream JSON', data=urlencode_postdata({ 'id': stream_key, 'data': 0, @@ -163,7 +164,7 @@ def extract_format(format_id, format_url): class SpankBangPlaylistIE(InfoExtractor): - _VALID_URL = r'https?://(?:[^/]+\.)?spankbang\.com/(?P[\da-z]+)/playlist/(?P[^/]+)' + _VALID_URL = r'https?://(?:[^/]+\.)?spankbang\.(?:com|party)/(?P[\da-z]+)/playlist/(?P[^/]+)' _TEST = { 'url': 'https://spankbang.com/ug0k/playlist/big+ass+titties', 'info_dict': { From 1d6d933044be98ddf97e493cd022f0313253366c Mon Sep 17 00:00:00 2001 From: Hawker2 <59458605+Hawker2@users.noreply.github.com> Date: Sun, 12 Jan 2025 15:04:56 -0600 Subject: [PATCH 2/2] Incorporates fixes for the bad playlist IDs, support for the spankbang.party domain, and country impersonation https://github.com/yt-dlp/yt-dlp/pull/7085 https://github.com/yt-dlp/yt-dlp/pull/10799 --- yt_dlp/extractor/spankbang.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/yt_dlp/extractor/spankbang.py b/yt_dlp/extractor/spankbang.py index 4546b88d5..2b5957c3e 100644 --- a/yt_dlp/extractor/spankbang.py +++ b/yt_dlp/extractor/spankbang.py @@ -113,6 +113,7 @@ def extract_format(format_id, format_url): stream_key = self._search_regex( r'data-streamkey\s*=\s*(["\'])(?P(?:(?!\1).)+)\1', webpage, 'stream key', group='value') + stream_domain = re.search(r'https?://(?:[^/]+\.)?(spankbang\.(?:com|party))/', url).group(1) stream_url = 'https://' + stream_domain + '/api/videos/stream' stream = self._download_json( @@ -130,6 +131,11 @@ def extract_format(format_id, format_url): format_url = format_url[0] extract_format(format_id, format_url) + og_url = self._search_regex( + r'