1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-10-31 14:45:14 +00:00

[ie] Fix m3u8 playlist data corruption (#13588)

Revert 7b81634fb1

Closes #13581
Authored by: bashonly
This commit is contained in:
bashonly
2025-06-30 18:06:22 -05:00
committed by GitHub
parent 2ba5391cd6
commit 500761e41a
2 changed files with 10 additions and 75 deletions

View File

@@ -1,6 +1,5 @@
import base64
import collections
import contextlib
import functools
import getpass
import http.client
@@ -2130,33 +2129,21 @@ class InfoExtractor:
raise ExtractorError(errnote, video_id=video_id)
self.report_warning(f'{errnote}{bug_reports_message()}')
return [], {}
if note is None:
note = 'Downloading m3u8 information'
if errnote is None:
errnote = 'Failed to download m3u8 information'
response = self._request_webpage(
m3u8_url, video_id, note=note, errnote=errnote,
res = self._download_webpage_handle(
m3u8_url, video_id,
note='Downloading m3u8 information' if note is None else note,
errnote='Failed to download m3u8 information' if errnote is None else errnote,
fatal=fatal, data=data, headers=headers, query=query)
if response is False:
if res is False:
return [], {}
with contextlib.closing(response):
prefix = response.read(512)
if not prefix.startswith(b'#EXTM3U'):
msg = 'Response data has no m3u header'
if fatal:
raise ExtractorError(msg, video_id=video_id)
self.report_warning(f'{msg}{bug_reports_message()}', video_id=video_id)
return [], {}
content = self._webpage_read_content(
response, m3u8_url, video_id, note=note, errnote=errnote,
fatal=fatal, prefix=prefix, data=data)
if content is False:
return [], {}
m3u8_doc, urlh = res
m3u8_url = urlh.url
return self._parse_m3u8_formats_and_subtitles(
content, response.url, ext=ext, entry_protocol=entry_protocol,
m3u8_doc, m3u8_url, ext=ext, entry_protocol=entry_protocol,
preference=preference, quality=quality, m3u8_id=m3u8_id,
note=note, errnote=errnote, fatal=fatal, live=live, data=data,
headers=headers, query=query, video_id=video_id)