mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-04-29 12:05:55 +00:00
Apply suggestions from code review
Co-authored-by: sepro <sepro@sepr0.com>
This commit is contained in:
parent
a75a02ad2a
commit
b42637c619
@ -97,13 +97,12 @@ class PiaLiveIE(InfoExtractor):
|
|||||||
player_tag_list = self._download_json(
|
player_tag_list = self._download_json(
|
||||||
f'{self.PIA_LIVE_API_URL}/perf/player-tag-list/{program_code}', **api_kwargs,
|
f'{self.PIA_LIVE_API_URL}/perf/player-tag-list/{program_code}', **api_kwargs,
|
||||||
note='Fetching player tag list', errnote='Unable to fetch player tag list')
|
note='Fetching player tag list', errnote='Unable to fetch player tag list')
|
||||||
|
chat_room_url = None
|
||||||
if self.get_param('getcomments'):
|
if self.get_param('getcomments'):
|
||||||
chat_room_url = traverse_obj(self._download_json(
|
chat_room_url = traverse_obj(self._download_json(
|
||||||
f'{self.PIA_LIVE_API_URL}/perf/chat-tag-list/{program_code}/{article_code}', **api_kwargs,
|
f'{self.PIA_LIVE_API_URL}/perf/chat-tag-list/{program_code}/{article_code}', **api_kwargs,
|
||||||
note='Fetching chat info', errnote='Unable to fetch chat info', fatal=False),
|
note='Fetching chat info', errnote='Unable to fetch chat info', fatal=False),
|
||||||
('data', 'chat_one_tag', {extract_attributes}, 'src', {url_or_none}))
|
('data', 'chat_one_tag', {extract_attributes}, 'src', {url_or_none}))
|
||||||
else:
|
|
||||||
chat_room_url = None
|
|
||||||
|
|
||||||
return self.url_result(
|
return self.url_result(
|
||||||
extract_attributes(player_tag_list['data']['movie_one_tag'])['src'], url_transparent=True,
|
extract_attributes(player_tag_list['data']['movie_one_tag'])['src'], url_transparent=True,
|
||||||
@ -114,7 +113,7 @@ class PiaLiveIE(InfoExtractor):
|
|||||||
if not chat_room_url:
|
if not chat_room_url:
|
||||||
return
|
return
|
||||||
if comment_page := self._download_webpage(
|
if comment_page := self._download_webpage(
|
||||||
chat_room_url, video_id, headers={'Referer': f'{self.PLAYER_ROOT_URL}'},
|
chat_room_url, video_id, headers={'Referer': self.PLAYER_ROOT_URL},
|
||||||
note='Fetching comment page', errnote='Unable to fetch comment page', fatal=False):
|
note='Fetching comment page', errnote='Unable to fetch comment page', fatal=False):
|
||||||
yield from traverse_obj(self._search_json(
|
yield from traverse_obj(self._search_json(
|
||||||
r'var\s+_history\s*=', comment_page, 'comment list',
|
r'var\s+_history\s*=', comment_page, 'comment list',
|
||||||
|
|||||||
@ -103,5 +103,5 @@ class PIAULIZAPortalIE(InfoExtractor):
|
|||||||
r'<script [^>]*\bsrc="(https://player-api\.p\.uliza\.jp/v1/players/[^"]+)"',
|
r'<script [^>]*\bsrc="(https://player-api\.p\.uliza\.jp/v1/players/[^"]+)"',
|
||||||
webpage, 'player data url')
|
webpage, 'player data url')
|
||||||
return self.url_result(
|
return self.url_result(
|
||||||
player_data_url, url_transparent=True,
|
player_data_url, PIAULIZAPortalAPIIE, url_transparent=True,
|
||||||
display_id=video_id, video_title=self._html_extract_title(webpage))
|
display_id=video_id, video_title=self._html_extract_title(webpage))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user