Skip to content

Commit

Permalink
[niconico] fix: download video while sending heartbeat (blackjack4494#72
Browse files Browse the repository at this point in the history
)
  • Loading branch information
insaneracist committed Oct 31, 2020
1 parent 709fe21 commit d3eb3aa
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions youtube_dlc/extractor/niconico.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,19 @@ def yesno(boolean):
}
}).encode())

heartbeat_url = '{}/{}?_format=json&_method=PUT'.format(session_api_endpoint['url'], session_response['data']['session']['id'])
heartbeat_headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
}
heartbeat = {
'data': json.dumps(session_response['data']),
'headers': heartbeat_headers,
'interval': session_api_data['heartbeat_lifetime'] / 2000,
'method': 'POST',
'url': heartbeat_url,
}

resolution = video_quality.get('resolution', {})

return {
Expand All @@ -264,6 +277,7 @@ def yesno(boolean):
'vbr': float_or_none(video_quality.get('bitrate'), 1000),
'height': resolution.get('height'),
'width': resolution.get('width'),
'heartbeat': heartbeat,
}

def _real_extract(self, url):
Expand Down

0 comments on commit d3eb3aa

Please sign in to comment.