summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-10-28 17:27:41 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-10-28 17:27:41 +0100
commitee966928af5f35123c4c7417bb052ae5aea345c9 (patch)
tree5817857a44437638135a099f1b351202c99667ce
parente5193599ecca2d4437d066e9fed95db74b8562c7 (diff)
downloadyoutube-dl-ee966928af5f35123c4c7417bb052ae5aea345c9.tar.gz
youtube-dl-ee966928af5f35123c4c7417bb052ae5aea345c9.tar.xz
youtube-dl-ee966928af5f35123c4c7417bb052ae5aea345c9.zip
[f4m] Support bootstrap URLs
-rw-r--r--youtube_dl/downloader/f4m.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/youtube_dl/downloader/f4m.py b/youtube_dl/downloader/f4m.py
index b3be16ff1..b607f6485 100644
--- a/youtube_dl/downloader/f4m.py
+++ b/youtube_dl/downloader/f4m.py
@@ -244,9 +244,16 @@ class F4mFD(FileDownloader):
                 lambda f: int(f[0]) == requested_bitrate, formats))[0]
 
         base_url = compat_urlparse.urljoin(man_url, media.attrib['url'])
-        bootstrap = base64.b64decode(doc.find(_add_ns('bootstrapInfo')).text)
+        bootstrap_node = doc.find(_add_ns('bootstrapInfo'))
+        if bootstrap_node.text is None:
+            bootstrap_url = compat_urlparse.urljoin(
+                base_url, bootstrap_node.attrib['url'])
+            bootstrap = self.ydl.urlopen(bootstrap_url).read()
+        else:
+            bootstrap = base64.b64decode(bootstrap_node.text)
         metadata = base64.b64decode(media.find(_add_ns('metadata')).text)
         boot_info = read_bootstrap_info(bootstrap)
+
         fragments_list = build_fragments_list(boot_info)
         if self.params.get('test', False):
             # We only download the first fragment