aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2012-12-15 17:50:45 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2012-12-15 17:50:45 +0100
commit8588a86f9e730b467d203124e9607b4cb1c22a5c (patch)
tree5719b8e3df2136f94c6d560afb8eee7034a933b1
parent5cb9c3129b177c7b4a9498f2f3f3e73993520d41 (diff)
Fix xvideo IE in Python 3
-rw-r--r--youtube_dl/InfoExtractors.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index b7fedabb2..1f5e18967 100644
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -2770,13 +2770,14 @@ class XVideosIE(InfoExtractor):
if mobj is None:
self._downloader.trouble(u'ERROR: invalid URL: %s' % url)
return
- video_id = mobj.group(1).decode('utf-8')
+ video_id = mobj.group(1)
self.report_webpage(video_id)
request = compat_urllib_request.Request(r'http://www.xvideos.com/video' + video_id)
try:
- webpage = compat_urllib_request.urlopen(request).read()
+ webpage_bytes = compat_urllib_request.urlopen(request).read()
+ webpage = webpage_bytes.decode('utf-8', 'replace')
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
@@ -2789,7 +2790,7 @@ class XVideosIE(InfoExtractor):
if mobj is None:
self._downloader.trouble(u'ERROR: unable to extract video url')
return
- video_url = compat_urllib_parse.unquote(mobj.group(1).decode('utf-8'))
+ video_url = compat_urllib_parse.unquote(mobj.group(1))
# Extract title
@@ -2797,7 +2798,7 @@ class XVideosIE(InfoExtractor):
if mobj is None:
self._downloader.trouble(u'ERROR: unable to extract video title')
return
- video_title = mobj.group(1).decode('utf-8')
+ video_title = mobj.group(1)
# Extract video thumbnail
@@ -2805,7 +2806,7 @@ class XVideosIE(InfoExtractor):
if mobj is None:
self._downloader.trouble(u'ERROR: unable to extract video thumbnail')
return
- video_thumbnail = mobj.group(0).decode('utf-8')
+ video_thumbnail = mobj.group(0)
info = {
'id': video_id,