[downloader/f4m] Fix use of base64 in python 3.2 (fixes #5132)
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Sun, 8 Mar 2015 17:25:11 +0000 (18:25 +0100)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Sun, 8 Mar 2015 17:25:11 +0000 (18:25 +0100)
b64decode needs a byte string, but on 3.4 it also accepts strings.

youtube_dl/downloader/f4m.py

index 3dc796faaf038c00383089274c0005382977a431..4ab000d6732cca5f71e8b8ab1d99dd5bfb49d57e 100644 (file)
@@ -281,7 +281,7 @@ class F4mFD(FileDownloader):
             boot_info = self._get_bootstrap_from_url(bootstrap_url)
         else:
             bootstrap_url = None
-            bootstrap = base64.b64decode(node.text)
+            bootstrap = base64.b64decode(node.text.encode('ascii'))
             boot_info = read_bootstrap_info(bootstrap)
         return (boot_info, bootstrap_url)
 
@@ -308,7 +308,7 @@ class F4mFD(FileDownloader):
         live = boot_info['live']
         metadata_node = media.find(_add_ns('metadata'))
         if metadata_node is not None:
-            metadata = base64.b64decode(metadata_node.text)
+            metadata = base64.b64decode(metadata_node.text.encode('ascii'))
         else:
             metadata = None