mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-03-09 12:50:23 -05:00
Apply suggestions from code review
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
This commit is contained in:
parent
a415863fe3
commit
db15a022ae
2 changed files with 5 additions and 4 deletions
|
@ -38,8 +38,7 @@ def send_ping():
|
||||||
|
|
||||||
request = Request(
|
request = Request(
|
||||||
f'{ping_url}?hash={md5_hash}&time={time}&paused={paused}&resolution={res}',
|
f'{ping_url}?hash={md5_hash}&time={time}&paused={paused}&resolution={res}',
|
||||||
headers=headers,
|
headers=headers)
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.ydl.urlopen(request).read()
|
self.ydl.urlopen(request).read()
|
||||||
|
|
|
@ -104,7 +104,9 @@ def _real_extract(self, url):
|
||||||
query=traverse_obj(parse_qs(url), {'token': 'token', 'expires': 'expires'}))
|
query=traverse_obj(parse_qs(url), {'token': 'token', 'expires': 'expires'}))
|
||||||
|
|
||||||
if html_title := self._html_extract_title(webpage, default=None) == '403':
|
if html_title := self._html_extract_title(webpage, default=None) == '403':
|
||||||
raise ExtractorError('This video is inaccessible. Setting a Referer header might be required to access the video', expected=True)
|
raise ExtractorError(
|
||||||
|
'This video is inaccessible. Setting a Referer header '
|
||||||
|
'might be required to access the video', expected=True)
|
||||||
elif html_title == '404':
|
elif html_title == '404':
|
||||||
raise ExtractorError('This video does not exist', expected=True)
|
raise ExtractorError('This video does not exist', expected=True)
|
||||||
|
|
||||||
|
@ -127,7 +129,7 @@ def _real_extract(self, url):
|
||||||
'quality': 1,
|
'quality': 1,
|
||||||
'http_headers': headers,
|
'http_headers': headers,
|
||||||
'ext': urlhandle_detect_ext(urlh, default='mp4'),
|
'ext': urlhandle_detect_ext(urlh, default='mp4'),
|
||||||
'filesize': int_or_none(urlh.headers.get('Content-Length')),
|
'filesize': int_or_none(urlh.get_header('Content-Length')),
|
||||||
})
|
})
|
||||||
|
|
||||||
# MediaCage Streams require activation and pings
|
# MediaCage Streams require activation and pings
|
||||||
|
|
Loading…
Reference in a new issue