1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-07-23 21:58:29 +00:00

Apply suggestions from code review

Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
This commit is contained in:
sepro 2025-07-13 00:43:14 +02:00 committed by GitHub
parent 5249b8ab4a
commit 307e5b3606
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -51,12 +51,12 @@ def _real_extract(self, url):
if format_url:
urlh = self._request_webpage(
HEADRequest(format_url), event_id, fatal=False, note='Checking stream')
if not urlh or urlh.status != 200:
if urlh and urlh.status == 200:
ext = urlhandle_detect_ext(urlh)
if ext == 'octet-stream':
self.report_warning(
'The server did not return a valid file extension for the stream URL, '
'defaulting to "mp3". Please ensure that the downloaded audio is actually mp3.')
'The server did not return a valid file extension for the stream URL. '
'Assuming an mp3 stream; postprocessing may fail if this is incorrect')
ext = 'mp3'
formats.append({
'url': format_url,
@ -116,7 +116,6 @@ def _real_extract(self, url):
return {
'id': recording_id,
'is_live': False,
**traverse_obj(recording_info, ('data', 'attributes', {
'ext': ('file_format', {str}),
'url': ('url', {url_or_none}),