1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-06-27 08:58:30 +00:00

Apply suggestions from code review

This commit is contained in:
bashonly 2025-06-26 17:38:38 +00:00 committed by GitHub
parent 4c84e32fd3
commit 022d5ffff6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -23,6 +23,7 @@ def real_download(self, filename, info_dict):
new_info_dict['protocol'] = 'm3u8'
def communicate_ws(reconnect):
# Support --load-info-json as if it is a reconnect attempt
if reconnect or not isinstance(ws_extractor, WebSocketResponse):
ws = self.ydl.urlopen(Request(
ws_url, headers={'Origin': 'https://live.nicovideo.jp'}))

View File

@ -817,7 +817,8 @@ def _real_extract(self, url):
{extract_attributes}, 'data-props', {json.loads}))
frontend_id = traverse_obj(embedded_data, ('site', 'frontendId', {str_or_none}), default='9')
ws_url = traverse_obj(embedded_data, ('site', 'relive', 'webSocketUrl', {url_or_none}, {require('websocket URL')}))
ws_url = traverse_obj(embedded_data, (
'site', 'relive', 'webSocketUrl', {url_or_none}, {require('websocket URL')}))
ws_url = update_url_query(ws_url, {'frontend_id': frontend_id})
ws = self._request_webpage(
ws_url, video_id, 'Connecting to WebSocket server',