aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2015-10-18 22:32:10 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2015-10-18 22:32:10 +0800
commit4285a47f4065037a00693838c0297bfee3fc22eb (patch)
treee6707ac5e3f99b60ccd531e2b883db67a293426b /youtube_dl/utils.py
parente36963e0eb57294f156a98c38df891dec41ebaa4 (diff)
parent05a3879f1c142cc2bf0287cde4690d8ccadcdc8f (diff)
Merge pull request #7208 from yan12125/letv-fix
[Letv] Fix extraction
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 """