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] [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 6805a72deb..1661feef34 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': {