From fad7c2a75a31f384fddda6a4240df3112b5a2c5a Mon Sep 17 00:00:00 2001 From: ChocoLZS Date: Fri, 23 Aug 2024 23:12:18 +0800 Subject: [PATCH] chore: remove smuggled_url --- yt_dlp/extractor/pialive.py | 11 ++++------- yt_dlp/extractor/piaulizaportal.py | 12 +++--------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/yt_dlp/extractor/pialive.py b/yt_dlp/extractor/pialive.py index 77f05b2006..da0750ec10 100644 --- a/yt_dlp/extractor/pialive.py +++ b/yt_dlp/extractor/pialive.py @@ -1,10 +1,10 @@ from .common import InfoExtractor from .piaulizaportal import PIAULIZAPortalAPIIE -from ..utils import ExtractorError, extract_attributes, multipart_encode, smuggle_url, traverse_obj +from ..utils import ExtractorError, extract_attributes, multipart_encode, traverse_obj class PiaLiveIE(InfoExtractor): - PLAYER_ROOT_URL = 'https://player.pia-live.jp' + PLAYER_ROOT_URL = 'https://player.pia-live.jp/' PIA_LIVE_API_URL = 'https://api.pia-live.jp' _VALID_URL = r'https?://player\.pia-live\.jp/stream/(?P[\w-]+)' @@ -42,10 +42,7 @@ class PiaLiveIE(InfoExtractor): if player_data_url.startswith(PIAULIZAPortalAPIIE.BASE_URL): return self.url_result( - smuggle_url( - player_data_url, - {'referer': self.PLAYER_ROOT_URL}, - ), + player_data_url, ie=PIAULIZAPortalAPIIE.ie_key(), url_transparent=True, **info_dict, @@ -81,7 +78,7 @@ class PiaLiveIE(InfoExtractor): )['data']['chat_one_tag'] chat_room_url = extract_attributes(chat_info)['src'] comment_page = self._download_webpage( - chat_room_url, program_code, headers={'Referer': f'{self.PLAYER_ROOT_URL}/'}, note='Fetching comment page', errnote='Unable to fetch comment page') + chat_room_url, program_code, headers={'Referer': f'{self.PLAYER_ROOT_URL}'}, note='Fetching comment page', errnote='Unable to fetch comment page') comment_list = self._search_json( r'var\s+_history\s*=', comment_page, 'comment list', program_code, contains_pattern=r'\[(?s:.+)\]') or [] diff --git a/yt_dlp/extractor/piaulizaportal.py b/yt_dlp/extractor/piaulizaportal.py index 62b8463e8d..a326c91bc1 100644 --- a/yt_dlp/extractor/piaulizaportal.py +++ b/yt_dlp/extractor/piaulizaportal.py @@ -1,5 +1,5 @@ from .common import InfoExtractor -from ..utils import ExtractorError, int_or_none, parse_qs, smuggle_url, time_seconds, traverse_obj, unsmuggle_url +from ..utils import ExtractorError, int_or_none, parse_qs, time_seconds, traverse_obj class PIAULIZAPortalAPIIE(InfoExtractor): @@ -48,12 +48,9 @@ class PIAULIZAPortalAPIIE(InfoExtractor): ] def _real_extract(self, url): - url, smuggled_data = unsmuggle_url(url, {}) tmp_video_id = self._search_regex(r'&name=([^&]+)', self._match_id(url), 'video id', default='unknown') player_data = self._download_webpage( - url, - tmp_video_id, - headers={'Referer': smuggled_data.get('referer') or f'{self.BASE_URL}/'}, + url, tmp_video_id, headers={'Referer': 'https://player-api.p.uliza.jp/'}, note='Fetching player data', errnote='Unable to fetch player data', ) @@ -119,10 +116,7 @@ class PIAULIZAPortalIE(InfoExtractor): PIAULIZAPortalAPIIE.TAG_REGEX, webpage, 'player data url') return self.url_result( - smuggle_url( - player_data_url, - {'referer': 'https://ulizaportal.jp/'}, - ), + player_data_url, ie=PIAULIZAPortalAPIIE.ie_key(), url_transparent=True, video_id=video_id,