diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2012-11-29 20:40:12 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2012-11-29 20:40:12 +0100 |
commit | 15c8d83358a964e8e5d12f1d0c55fe96fc111a01 (patch) | |
tree | 9d05b382ba59af3238dbf2c0c8fe8f61a51d450b /youtube_dl/InfoExtractors.py | |
parent | e91d2338d8f5be16d8cd052d38c20bec9d5583ab (diff) |
Fix Soundcloud IE (+ Python3 support)
Diffstat (limited to 'youtube_dl/InfoExtractors.py')
-rw-r--r-- | youtube_dl/InfoExtractors.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py index 925dabc96..e5e8f41f0 100644 --- a/youtube_dl/InfoExtractors.py +++ b/youtube_dl/InfoExtractors.py @@ -2818,16 +2818,17 @@ class SoundcloudIE(InfoExtractor): return # extract uploader (which is in the url) - uploader = mobj.group(1).decode('utf-8') + uploader = mobj.group(1) # extract simple title (uploader + slug of song title) - slug_title = mobj.group(2).decode('utf-8') + slug_title = mobj.group(2) simple_title = uploader + u'-' + slug_title self.report_webpage('%s/%s' % (uploader, slug_title)) request = compat_urllib_request.Request('http://soundcloud.com/%s/%s' % (uploader, slug_title)) try: - webpage = compat_urllib_request.urlopen(request).read() + webpage_bytes = compat_urllib_request.urlopen(request).read() + webpage = webpage_bytes.decode('utf-8') except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err)) return @@ -2843,7 +2844,7 @@ class SoundcloudIE(InfoExtractor): # extract unsimplified title mobj = re.search('"title":"(.*?)",', webpage) if mobj: - title = mobj.group(1).decode('utf-8') + title = mobj.group(1) else: title = simple_title @@ -2870,13 +2871,13 @@ class SoundcloudIE(InfoExtractor): request = compat_urllib_request.Request('http://media.soundcloud.com/crossdomain.xml', std_headers) return [{ - 'id': video_id.decode('utf-8'), + 'id': video_id, 'url': mediaURL, - 'uploader': uploader.decode('utf-8'), + 'uploader': uploader, 'upload_date': upload_date, 'title': title, 'ext': u'mp3', - 'description': description.decode('utf-8') + 'description': description }] |