aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/mixcloud.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-08-18 23:31:42 +0700
committerSergey M․ <dstftw@gmail.com>2017-08-18 23:31:42 +0700
commitd14d9d8903a532e346dffc3b83730045f18f2c28 (patch)
treea9322864832267306207a973b7ff16c68ef4e119 /youtube_dl/extractor/mixcloud.py
parentea004d34f83fd7dd9a00fc3e2deb5a101aff6ea7 (diff)
[mixcloud] Fix extraction (closes #13958)
Diffstat (limited to 'youtube_dl/extractor/mixcloud.py')
-rw-r--r--youtube_dl/extractor/mixcloud.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/youtube_dl/extractor/mixcloud.py b/youtube_dl/extractor/mixcloud.py
index fcf7beeb2..798968ae3 100644
--- a/youtube_dl/extractor/mixcloud.py
+++ b/youtube_dl/extractor/mixcloud.py
@@ -91,12 +91,14 @@ class MixcloudIE(InfoExtractor):
if js_url:
js = self._download_webpage(js_url, track_id, fatal=False)
if js:
- key = self._search_regex(
- r'player\s*:\s*{.*?\bvalue\s*:\s*(["\'])(?P<key>(?:(?!\1).)+)\1',
- js, 'key', default=None, group='key')
- if key and isinstance(key, compat_str):
- self._keys.insert(0, key)
- self._current_key = key
+ KEY_RE_TEMPLATE = r'player\s*:\s*{.*?\b%s\s*:\s*(["\'])(?P<key>(?:(?!\1).)+)\1'
+ for key_name in ('value', 'key_value'):
+ key = self._search_regex(
+ KEY_RE_TEMPLATE % key_name, js, 'key',
+ default=None, group='key')
+ if key and isinstance(key, compat_str):
+ self._keys.insert(0, key)
+ self._current_key = key
message = self._html_search_regex(
r'(?s)<div[^>]+class="global-message cloudcast-disabled-notice-light"[^>]*>(.+?)<(?:a|/div)',