aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2015-07-22 20:03:05 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2015-10-18 13:42:57 +0800
commit1e399778ee870ee583135e65458268cd7c0fb923 (patch)
treee14fb762ed518da7b5fcc6f113da3a3d48805b11 /youtube_dl/utils.py
parent2ccb37beb9e35ebbf2cdf65a4c1641e5286de1e8 (diff)
[letv] Fix extraction
Using data URIs for passing the decrypted M3U8 manifest, which is supported by ffmpeg only.
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 7dbe25661..db5b3698e 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -3,6 +3,7 @@
from __future__ import unicode_literals
+import base64
import calendar
import codecs
import contextlib
@@ -1795,6 +1796,10 @@ def urlhandle_detect_ext(url_handle):
return mimetype2ext(getheader('Content-Type'))
+def encode_data_uri(data, mime_type):
+ return 'data:%s;base64,%s' % (mime_type, base64.b64encode(data).decode('ascii'))
+
+
def age_restricted(content_limit, age_limit):
""" Returns True iff the content should be blocked """