1
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-05-09 15:57:12 -05:00

Apply suggestions from code review

Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
This commit is contained in:
sepro 2025-02-17 17:26:57 +01:00 committed by GitHub
parent a415863fe3
commit db15a022ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -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()

View file

@ -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