mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 02:42:30 +00:00
[extractor/generic] Detect m3u playlists served without proper Content-Type
This commit is contained in:
parent
de6c51e88e
commit
5940862d5a
@ -1299,9 +1299,15 @@ def _real_extract(self, url):
|
|||||||
request.add_header('Accept-Encoding', '*')
|
request.add_header('Accept-Encoding', '*')
|
||||||
full_response = self._request_webpage(request, video_id)
|
full_response = self._request_webpage(request, video_id)
|
||||||
|
|
||||||
|
first_bytes = full_response.read(512)
|
||||||
|
|
||||||
|
# Is it an M3U playlist?
|
||||||
|
if first_bytes.startswith('#EXTM3U'):
|
||||||
|
info_dict['formats'] = self._extract_m3u8_formats(url, video_id, 'mp4')
|
||||||
|
return info_dict
|
||||||
|
|
||||||
# Maybe it's a direct link to a video?
|
# Maybe it's a direct link to a video?
|
||||||
# Be careful not to download the whole thing!
|
# Be careful not to download the whole thing!
|
||||||
first_bytes = full_response.read(512)
|
|
||||||
if not is_html(first_bytes):
|
if not is_html(first_bytes):
|
||||||
self._downloader.report_warning(
|
self._downloader.report_warning(
|
||||||
'URL could be a direct video link, returning it as such.')
|
'URL could be a direct video link, returning it as such.')
|
||||||
|
Loading…
Reference in New Issue
Block a user