diff options
author | Sergey M․ <dstftw@gmail.com> | 2015-11-21 18:01:39 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2015-11-21 18:01:39 +0600 |
commit | 019839faaa28d6233097a669d063a3a42f9fbbc7 (patch) | |
tree | 3e001f84792ce1c753d3baf0435eb25065d3710a | |
parent | f52183a8780a7b9e58ffb4510e234a7392ad8a2f (diff) |
[extractor/common] Use baseURL from f4m manifest for recursive manifest extraction
-rw-r--r-- | youtube_dl/extractor/common.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 5e263f8b5..71bdcad5a 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -891,6 +891,11 @@ class InfoExtractor(object): if not media_nodes: manifest_version = '2.0' media_nodes = manifest.findall('{http://ns.adobe.com/f4m/2.0}media') + base_url = xpath_text( + manifest, ['{http://ns.adobe.com/f4m/1.0}baseURL', '{http://ns.adobe.com/f4m/2.0}baseURL'], + 'base URL', default=None) + if base_url: + base_url = base_url.strip() for i, media_el in enumerate(media_nodes): if manifest_version == '2.0': media_url = media_el.attrib.get('href') or media_el.attrib.get('url') @@ -898,7 +903,7 @@ class InfoExtractor(object): continue manifest_url = ( media_url if media_url.startswith('http://') or media_url.startswith('https://') - else ('/'.join(manifest_url.split('/')[:-1]) + '/' + media_url)) + else ((base_url or '/'.join(manifest_url.split('/')[:-1])) + '/' + media_url)) # If media_url is itself a f4m manifest do the recursive extraction # since bitrates in parent manifest (this one) and media_url manifest # may differ leading to inability to resolve the format by requested |