diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-03-10 20:56:24 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-03-11 22:07:42 +0530 |
commit | 0a473f2f0fd2629f009edb8bf127c4eed1738bf6 (patch) | |
tree | 01f36da16a89783568286c7ebf8cd75934d2e41e /yt_dlp/downloader/external.py | |
parent | e4edeb6226e2ba1433e562f52fa37b00e3da1a17 (diff) | |
download | hypervideo-pre-0a473f2f0fd2629f009edb8bf127c4eed1738bf6.tar.lz hypervideo-pre-0a473f2f0fd2629f009edb8bf127c4eed1738bf6.tar.xz hypervideo-pre-0a473f2f0fd2629f009edb8bf127c4eed1738bf6.zip |
More improvements to HLS/DASH external downloader code
* Fix error when there is no `protocol` in `info_dict`
* Move HLS byte range detection to `Aria2cFD` so that the download will fall back to the native downloader instead of ffmpeg
* Fix bug with getting no fragments in DASH
* Convert `check_results` in `can_download` to a generator
Diffstat (limited to 'yt_dlp/downloader/external.py')
-rw-r--r-- | yt_dlp/downloader/external.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/yt_dlp/downloader/external.py b/yt_dlp/downloader/external.py index 026a4e382..c315deb2e 100644 --- a/yt_dlp/downloader/external.py +++ b/yt_dlp/downloader/external.py @@ -125,7 +125,7 @@ class ExternalFD(FileDownloader): if 'fragments' in info_dict: file_list = [] dest, _ = sanitize_open(tmpfilename, 'wb') - for [i, fragment] in enumerate(info_dict['fragments']): + for i, fragment in enumerate(info_dict['fragments']): file = '%s_%s.frag' % (tmpfilename, i) decrypt_info = fragment.get('decrypt_info') src, _ = sanitize_open(file, 'rb') @@ -242,6 +242,15 @@ class Aria2cFD(ExternalFD): AVAILABLE_OPT = '-v' SUPPORTED_PROTOCOLS = ('http', 'https', 'ftp', 'ftps', 'frag_urls') + @staticmethod + def supports_manifest(manifest): + UNSUPPORTED_FEATURES = [ + r'#EXT-X-BYTERANGE', # playlists composed of byte ranges of media files [1] + # 1. https://tools.ietf.org/html/draft-pantos-http-live-streaming-17#section-4.3.2.2 + ] + check_results = (not re.search(feature, manifest) for feature in UNSUPPORTED_FEATURES) + return all(check_results) + def _make_cmd(self, tmpfilename, info_dict): cmd = [self.exe, '-c'] dn = os.path.dirname(tmpfilename) @@ -264,7 +273,7 @@ class Aria2cFD(ExternalFD): cmd += ['--uri-selector', 'inorder', '--download-result=hide'] url_list_file = '%s.frag.urls' % tmpfilename url_list = [] - for [i, fragment] in enumerate(info_dict['fragments']): + for i, fragment in enumerate(info_dict['fragments']): tmpsegmentname = '%s_%s.frag' % (os.path.basename(tmpfilename), i) url_list.append('%s\n\tout=%s' % (fragment['url'], tmpsegmentname)) stream, _ = sanitize_open(url_list_file, 'wb') |