summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPhilipp Hagemeister <[email protected]>2012-12-15 18:23:17 +0100
committerPhilipp Hagemeister <[email protected]>2012-12-15 18:23:17 +0100
commit28ca6b5afab97f34ff08cad9ba1d09b0cb109a91 (patch)
treee043abc3f44f771a621bca81618c84201acfbf24
parentbec102a843bbc8e53f5cf3a71f1259536e62b70b (diff)
downloadyoutube-dl-28ca6b5afab97f34ff08cad9ba1d09b0cb109a91.tar.gz
youtube-dl-28ca6b5afab97f34ff08cad9ba1d09b0cb109a91.zip
Fix Dailymotion in Python 3
-rw-r--r--youtube_dl/InfoExtractors.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index 637b14bc0..f3182c113 100644
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -666,7 +666,8 @@ class DailymotionIE(InfoExtractor):
request.add_header('Cookie', 'family_filter=off')
try:
self.report_download_webpage(video_id)
- 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:
self._downloader.trouble(u'ERROR: unable retrieve video webpage: %s' % compat_str(err))
return
@@ -701,7 +702,7 @@ class DailymotionIE(InfoExtractor):
if mobj is None:
self._downloader.trouble(u'ERROR: unable to extract title')
return
- video_title = unescapeHTML(mobj.group('title').decode('utf-8'))
+ video_title = unescapeHTML(mobj.group('title'))
video_uploader = None
mobj = re.search(r'(?im)<span class="owner[^\"]+?">[^<]+?<a [^>]+?>([^<]+?)</a>', webpage)
@@ -721,12 +722,12 @@ class DailymotionIE(InfoExtractor):
video_upload_date = mobj.group(3) + mobj.group(2) + mobj.group(1)
return [{
- 'id': video_id.decode('utf-8'),
- 'url': video_url.decode('utf-8'),
- 'uploader': video_uploader.decode('utf-8'),
+ 'id': video_id,
+ 'url': video_url,
+ 'uploader': video_uploader,
'upload_date': video_upload_date,
'title': video_title,
- 'ext': video_extension.decode('utf-8'),
+ 'ext': video_extension,
}]