aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2012-07-18 21:17:51 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2012-07-18 21:17:51 +0200
commit3210735c499e6a7d0b4df4b8120e17bd7ba8927b (patch)
tree248d6aeb3f56753452472c43255be42d9b17b0a6
parentcca4828ac94e6d2e4e1918405d0fcbc8e6ac92d0 (diff)
Fix EscapistMagazine IE
-rw-r--r--youtube_dl/InfoExtractors.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index baf859ea8..499d9b1ae 100644
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -2193,12 +2193,14 @@ class EscapistIE(InfoExtractor):
self.report_extraction(showName)
try:
- webPageBytes = urllib2.urlopen(url).read()
+ webPage = urllib2.urlopen(url)
+ webPageBytes = webPage.read()
+ m = re.match(r'text/html; charset="?([^"]+)"?', webPage.headers['Content-Type'])
+ webPage = webPageBytes.decode(m.group(1) if m else 'utf-8')
except (urllib2.URLError, httplib.HTTPException, socket.error), err:
self._downloader.trouble(u'ERROR: unable to download webpage: ' + unicode(err))
return
- webPage = webPageBytes.decode('utf-8')
descMatch = re.search('<meta name="description" content="([^"]*)"', webPage)
description = unescapeHTML(descMatch.group(1))
imgMatch = re.search('<meta property="og:image" content="([^"]*)"', webPage)