0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-30 03:33:02 +00:00

Decode the data requested to the api in utf-8.

This commit is contained in:
Juan M 2013-02-23 22:47:22 +01:00
parent 4be0aa3539
commit d1b7a24354

View file

@ -1472,7 +1472,7 @@ def _download_n_results(self, query, n):
result_url = self._API_URL % (compat_urllib_parse.quote_plus(query), (50*pagenum)+1) result_url = self._API_URL % (compat_urllib_parse.quote_plus(query), (50*pagenum)+1)
request = compat_urllib_request.Request(result_url) request = compat_urllib_request.Request(result_url)
try: try:
data = compat_urllib_request.urlopen(request).read() data = compat_urllib_request.urlopen(request).read().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 API page: %s' % compat_str(err)) self._downloader.trouble(u'ERROR: unable to download API page: %s' % compat_str(err))
return return