X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fmixcloud.py;h=bcac13ec5edfdeb83216e732b46ae34a36656205;hb=56667d622c3f6e7594a04f8cd5f4371875940725;hp=4811823802c46e709116ef2e2daefe53c123c70a;hpb=2384f5a64e501d7abb844e8d31fe340b34d8d4e7;p=youtube-dl
diff --git a/youtube_dl/extractor/mixcloud.py b/youtube_dl/extractor/mixcloud.py
index 481182380..bcac13ec5 100644
--- a/youtube_dl/extractor/mixcloud.py
+++ b/youtube_dl/extractor/mixcloud.py
@@ -1,14 +1,15 @@
from __future__ import unicode_literals
-import base64
import functools
import itertools
import re
from .common import InfoExtractor
from ..compat import (
+ compat_b64decode,
compat_chr,
compat_ord,
+ compat_str,
compat_urllib_parse_unquote,
compat_urlparse,
compat_zip
@@ -16,9 +17,12 @@ from ..compat import (
from ..utils import (
clean_html,
ExtractorError,
+ int_or_none,
OnDemandPagedList,
str_to_int,
- try_get)
+ try_get,
+ urljoin,
+)
class MixcloudIE(InfoExtractor):
@@ -61,13 +65,6 @@ class MixcloudIE(InfoExtractor):
compat_chr(compat_ord(ch) ^ compat_ord(k))
for ch, k in compat_zip(ciphertext, itertools.cycle(key))])
- @staticmethod
- def _decrypt_and_extend(stream_info, url_key, getter, key, formats):
- maybe_url = stream_info.get(url_key)
- if maybe_url is not None:
- decrypted = MixcloudIE._decrypt_xor_cipher(key, base64.b64decode(maybe_url))
- formats.extend(getter(decrypted))
-
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
uploader = mobj.group(1)
@@ -82,13 +79,16 @@ class MixcloudIE(InfoExtractor):
if encrypted_play_info is not None:
# Decode
- encrypted_play_info = base64.b64decode(encrypted_play_info)
+ encrypted_play_info = compat_b64decode(encrypted_play_info)
else:
# New path
full_info_json = self._parse_json(self._html_search_regex(
- r'', webpage, 'play info'), 'play info')
+ r'',
+ webpage, 'play info'), 'play info')
for item in full_info_json:
- item_data = try_get(item, lambda x: x['cloudcast']['data']['cloudcastLookup'])
+ item_data = try_get(
+ item, lambda x: x['cloudcast']['data']['cloudcastLookup'],
+ dict)
if try_get(item_data, lambda x: x['streamInfo']['url']):
info_json = item_data
break
@@ -100,25 +100,22 @@ class MixcloudIE(InfoExtractor):
webpage, 'error message', default=None)
js_url = self._search_regex(
- r'