1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-02 17:22:31 +01:00

Better error reporting for SoundCloud IE

This commit is contained in:
Philipp Hagemeister 2012-12-07 00:40:13 +01:00
parent 0f8d03f81c
commit b4cd069d5e

View File

@ -2825,9 +2825,10 @@ def _real_extract(self, url):
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)) url = 'https://soundcloud.com/%s/%s' % (uploader, slug_title)
request = compat_urllib_request.Request(url)
try: try:
webpage_bytes = compat_urllib_request.urlopen(request).read() urlo = compat_urllib_request.urlopen(request).read()
webpage = webpage_bytes.decode('utf-8') 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))
@ -2840,6 +2841,9 @@ def _real_extract(self, url):
if mobj: if mobj:
video_id = mobj.group(1) video_id = mobj.group(1)
stream_token = mobj.group(2) stream_token = mobj.group(2)
else:
self._downloader.trouble(u'ERROR: unable to find video ID in Soundcloud file')
return
# extract unsimplified title # extract unsimplified title
mobj = re.search('"title":"(.*?)",', webpage) mobj = re.search('"title":"(.*?)",', webpage)