mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-02 06:27:21 +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 @@ def _real_extract(self, url):
|
|||
player_tag_list = self._download_json(
|
||||
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')
|
||||
chat_room_url = None
|
||||
if self.get_param('getcomments'):
|
||||
chat_room_url = traverse_obj(self._download_json(
|
||||
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),
|
||||
('data', 'chat_one_tag', {extract_attributes}, 'src', {url_or_none}))
|
||||
else:
|
||||
chat_room_url = None
|
||||
|
||||
return self.url_result(
|
||||
extract_attributes(player_tag_list['data']['movie_one_tag'])['src'], url_transparent=True,
|
||||
|
@ -114,7 +113,7 @@ def _get_comments(self, video_id, chat_room_url):
|
|||
if not chat_room_url:
|
||||
return
|
||||
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):
|
||||
yield from traverse_obj(self._search_json(
|
||||
r'var\s+_history\s*=', comment_page, 'comment list',
|
||||
|
|
|
@ -103,5 +103,5 @@ def _real_extract(self, url):
|
|||
r'<script [^>]*\bsrc="(https://player-api\.p\.uliza\.jp/v1/players/[^"]+)"',
|
||||
webpage, 'player data url')
|
||||
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))
|
||||
|
|
Loading…
Reference in a new issue