chore: remove unnecessary smuggled data

This commit is contained in:
ChocoLZS 2024-08-23 10:01:07 +08:00
parent 95dffc0e75
commit 1a22cc3d3f
2 changed files with 7 additions and 8 deletions

View File

@ -37,14 +37,14 @@ class PiaLiveIE(InfoExtractor):
}, },
] ]
def handle_embed_player(self, player_tag, video_id, info_dict={}): def handle_embed_player(self, player_tag, info_dict={}):
player_data_url = extract_attributes(player_tag)['src'] player_data_url = extract_attributes(player_tag)['src']
if player_data_url.startswith(PIAULIZAPortalAPIIE.BASE_URL): if player_data_url.startswith(PIAULIZAPortalAPIIE.BASE_URL):
return self.url_result( return self.url_result(
smuggle_url( smuggle_url(
player_data_url, player_data_url,
{'video_id': video_id, 'referer': self.PLAYER_ROOT_URL}, {'referer': self.PLAYER_ROOT_URL},
), ),
ie=PIAULIZAPortalAPIIE.ie_key(), ie=PIAULIZAPortalAPIIE.ie_key(),
url_transparent=True, url_transparent=True,
@ -77,7 +77,7 @@ class PiaLiveIE(InfoExtractor):
article_code = self._search_regex(r"const articleCode = '(.*?)';", webpage, 'article code') article_code = self._search_regex(r"const articleCode = '(.*?)';", webpage, 'article code')
chat_info = self._download_json( chat_info = self._download_json(
f'{self.PIA_LIVE_API_URL}/perf/chat-tag-list/{program_code}/{article_code}', f'{self.PIA_LIVE_API_URL}/perf/chat-tag-list/{program_code}/{article_code}',
article_code, data=payload, headers={'Content-Type': content_type, 'Referer': self.PLAYER_ROOT_URL}, program_code, data=payload, headers={'Content-Type': content_type, 'Referer': self.PLAYER_ROOT_URL},
)['data']['chat_one_tag'] )['data']['chat_one_tag']
chat_room_url = extract_attributes(chat_info)['src'] chat_room_url = extract_attributes(chat_info)['src']
comment_page = self._download_webpage( comment_page = self._download_webpage(
@ -95,7 +95,6 @@ class PiaLiveIE(InfoExtractor):
return self.handle_embed_player( return self.handle_embed_player(
player_tag_list['data']['movie_one_tag'], player_tag_list['data']['movie_one_tag'],
video_id=program_code,
info_dict={ info_dict={
'id': program_code, 'id': program_code,
'title': self._html_extract_title(webpage), 'title': self._html_extract_title(webpage),

View File

@ -49,7 +49,7 @@ class PIAULIZAPortalAPIIE(InfoExtractor):
def _real_extract(self, url): def _real_extract(self, url):
url, smuggled_data = unsmuggle_url(url, {}) url, smuggled_data = unsmuggle_url(url, {})
tmp_video_id = smuggled_data.get('video_id') or self._search_regex(r'&name=([^&]+)', self._match_id(url), 'video id', default='unknown') tmp_video_id = self._search_regex(r'&name=([^&]+)', self._match_id(url), 'video id', default='unknown')
player_data = self._download_webpage( player_data = self._download_webpage(
url, url,
tmp_video_id, tmp_video_id,
@ -61,7 +61,7 @@ class PIAULIZAPortalAPIIE(InfoExtractor):
r'["\'](https://vms-api\.p\.uliza\.jp/v1/prog-index\.m3u8[^"\']+)', player_data, r'["\'](https://vms-api\.p\.uliza\.jp/v1/prog-index\.m3u8[^"\']+)', player_data,
'm3u8 url', default=None) 'm3u8 url', default=None)
video_id = smuggled_data.get('video_id') or self._search_regex(r'&?ss=([\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12})&?', m3u8_url, 'video id', default=tmp_video_id) video_id = self._search_regex(r'&?ss=([\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12})&?', m3u8_url, 'video id', default=tmp_video_id)
formats = self._extract_m3u8_formats( formats = self._extract_m3u8_formats(
m3u8_url, m3u8_url,
@ -70,7 +70,7 @@ class PIAULIZAPortalAPIIE(InfoExtractor):
r'/hls/(dvr|video)/', traverse_obj(formats, (0, 'url')), 'm3u8 type', default=None) r'/hls/(dvr|video)/', traverse_obj(formats, (0, 'url')), 'm3u8 type', default=None)
return { return {
'id': video_id, 'id': video_id,
'title': smuggled_data.get('video_title') or video_id, 'title': video_id,
'formats': formats, 'formats': formats,
'live_status': { 'live_status': {
'video': 'is_live', 'video': 'is_live',
@ -121,7 +121,7 @@ class PIAULIZAPortalIE(InfoExtractor):
return self.url_result( return self.url_result(
smuggle_url( smuggle_url(
player_data_url, player_data_url,
{'video_id': video_id, 'referer': 'https://ulizaportal.jp/'}, {'referer': 'https://ulizaportal.jp/'},
), ),
ie=PIAULIZAPortalAPIIE.ie_key(), ie=PIAULIZAPortalAPIIE.ie_key(),
url_transparent=True, url_transparent=True,