Fix Unicode handling GenericIE (Fixes #734)

This commit is contained in:
Philipp Hagemeister 2013-03-08 20:47:06 +01:00
parent e5edd51de4
commit 3d3423574d
2 changed files with 9 additions and 7 deletions

View File

@ -293,5 +293,11 @@
"info_dict": { "info_dict": {
"title": "Absolute Mehrheit vom 17.02.2013 - Die Highlights, Teil 2" "title": "Absolute Mehrheit vom 17.02.2013 - Die Highlights, Teil 2"
} }
},
{
"name": "Generic",
"url": "http://www.hodiho.fr/2013/02/regis-plante-sa-jeep.html",
"file": "13601338388002.mp4",
"md5": "85b90ccc9d73b4acd9138d3af4c27f89"
} }
] ]

View File

@ -1281,7 +1281,8 @@ def __init__(self, downloader=None):
def report_download_webpage(self, video_id): def report_download_webpage(self, video_id):
"""Report webpage download.""" """Report webpage download."""
self._downloader.to_screen(u'WARNING: Falling back on generic information extractor.') if not self._downloader.params.get('test', False):
self._downloader.to_screen(u'WARNING: Falling back on generic information extractor.')
self._downloader.to_screen(u'[generic] %s: Downloading webpage' % video_id) self._downloader.to_screen(u'[generic] %s: Downloading webpage' % video_id)
def report_extraction(self, video_id): def report_extraction(self, video_id):
@ -1351,13 +1352,8 @@ def _real_extract(self, url):
if self._test_redirect(url): return if self._test_redirect(url): return
video_id = url.split('/')[-1] video_id = url.split('/')[-1]
request = compat_urllib_request.Request(url)
try: try:
self.report_download_webpage(video_id) webpage = self._download_webpage(url, video_id)
webpage = compat_urllib_request.urlopen(request).read()
except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err))
return
except ValueError as err: except ValueError as err:
# since this is the last-resort InfoExtractor, if # since this is the last-resort InfoExtractor, if
# this error is thrown, it'll be thrown here # this error is thrown, it'll be thrown here