mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 12:01:28 +00:00
Fix Soundcloud IE (+ Python3 support)
This commit is contained in:
parent
e91d2338d8
commit
15c8d83358
|
@ -2818,16 +2818,17 @@ def _real_extract(self, url):
|
||||||
return
|
return
|
||||||
|
|
||||||
# extract uploader (which is in the url)
|
# 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)
|
# 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
|
simple_title = uploader + u'-' + slug_title
|
||||||
|
|
||||||
self.report_webpage('%s/%s' % (uploader, slug_title))
|
self.report_webpage('%s/%s' % (uploader, slug_title))
|
||||||
|
|
||||||
request = compat_urllib_request.Request('http://soundcloud.com/%s/%s' % (uploader, slug_title))
|
request = compat_urllib_request.Request('http://soundcloud.com/%s/%s' % (uploader, slug_title))
|
||||||
try:
|
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:
|
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))
|
self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err))
|
||||||
return
|
return
|
||||||
|
@ -2843,7 +2844,7 @@ def _real_extract(self, url):
|
||||||
# extract unsimplified title
|
# extract unsimplified title
|
||||||
mobj = re.search('"title":"(.*?)",', webpage)
|
mobj = re.search('"title":"(.*?)",', webpage)
|
||||||
if mobj:
|
if mobj:
|
||||||
title = mobj.group(1).decode('utf-8')
|
title = mobj.group(1)
|
||||||
else:
|
else:
|
||||||
title = simple_title
|
title = simple_title
|
||||||
|
|
||||||
|
@ -2870,13 +2871,13 @@ def _real_extract(self, url):
|
||||||
request = compat_urllib_request.Request('http://media.soundcloud.com/crossdomain.xml', std_headers)
|
request = compat_urllib_request.Request('http://media.soundcloud.com/crossdomain.xml', std_headers)
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
'id': video_id.decode('utf-8'),
|
'id': video_id,
|
||||||
'url': mediaURL,
|
'url': mediaURL,
|
||||||
'uploader': uploader.decode('utf-8'),
|
'uploader': uploader,
|
||||||
'upload_date': upload_date,
|
'upload_date': upload_date,
|
||||||
'title': title,
|
'title': title,
|
||||||
'ext': u'mp3',
|
'ext': u'mp3',
|
||||||
'description': description.decode('utf-8')
|
'description': description
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue