diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2014-01-17 04:05:15 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2014-01-17 04:05:15 +0100 |
commit | dd2535c38af39481ecb7220c237c7647c9c8faae (patch) | |
tree | f669800021482787955c5d89bb77e5503070e6ee /youtube_dl/extractor | |
parent | b78d1801707b0509cf5aecf8fd2ab427f444074b (diff) |
[mixcloud] Fix URL extraction
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r-- | youtube_dl/extractor/mixcloud.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/youtube_dl/extractor/mixcloud.py b/youtube_dl/extractor/mixcloud.py index 7c54ea0f4..2796dcd98 100644 --- a/youtube_dl/extractor/mixcloud.py +++ b/youtube_dl/extractor/mixcloud.py @@ -42,17 +42,18 @@ class MixcloudIE(InfoExtractor): def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) - uploader = mobj.group(1) cloudcast_name = mobj.group(2) track_id = '-'.join((uploader, cloudcast_name)) - api_url = 'http://api.mixcloud.com/%s/%s/' % (uploader, cloudcast_name) + webpage = self._download_webpage(url, track_id) - json_data = self._download_webpage(api_url, track_id, - u'Downloading cloudcast info') - info = json.loads(json_data) - preview_url = self._search_regex(r'data-preview-url="(.+?)"', webpage, u'preview url') + api_url = 'http://api.mixcloud.com/%s/%s/' % (uploader, cloudcast_name) + info = self._download_json( + api_url, track_id, u'Downloading cloudcast info') + + preview_url = self._search_regex( + r'\s(?:data-preview-url|m-preview)="(.+?)"', webpage, u'preview url') song_url = preview_url.replace('/previews/', '/c/originals/') template_url = re.sub(r'(stream\d*)', 'stream%d', song_url) final_song_url = self._get_url(template_url) |