diff options
author | Sergey M․ <dstftw@gmail.com> | 2016-03-18 22:45:28 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2016-03-18 22:45:28 +0600 |
commit | 5940862d5a75ae45a640e0ce3104dd18c9864e26 (patch) | |
tree | 1273493555a6f33e57becd2fc4d217074e068ce2 /youtube_dl/extractor | |
parent | de6c51e88eb61b49a95ccfcfa82547c2172eb52b (diff) |
[extractor/generic] Detect m3u playlists served without proper Content-Type
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r-- | youtube_dl/extractor/generic.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py index 5649e26da..24d43a247 100644 --- a/youtube_dl/extractor/generic.py +++ b/youtube_dl/extractor/generic.py @@ -1299,9 +1299,15 @@ class GenericIE(InfoExtractor): request.add_header('Accept-Encoding', '*') 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? # Be careful not to download the whole thing! - first_bytes = full_response.read(512) if not is_html(first_bytes): self._downloader.report_warning( 'URL could be a direct video link, returning it as such.') |