diff options
author | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2014-02-21 16:59:10 +0100 |
---|---|---|
committer | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2014-02-21 16:59:10 +0100 |
commit | f7300c5c90a99d234a2c7a6d70f5b5baa9d35046 (patch) | |
tree | 64220815f5e1399a23b7b0a312a0395adcc64263 /youtube_dl/extractor | |
parent | 3489b7d26c727dac604cf9ece562139372da9bb7 (diff) |
[generic] Fix on python 2.6
`ParseError` is not available, it raises `xml.parsers.expat.ExpatError`.
The webpage needs to be encoded.
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r-- | youtube_dl/extractor/generic.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py index 30160d59d..9a2e54d14 100644 --- a/youtube_dl/extractor/generic.py +++ b/youtube_dl/extractor/generic.py @@ -13,6 +13,7 @@ from ..utils import ( compat_urllib_parse, compat_urllib_request, compat_urlparse, + compat_xml_parse_error, ExtractorError, HEADRequest, @@ -241,10 +242,10 @@ class GenericIE(InfoExtractor): # Is it an RSS feed? try: - doc = xml.etree.ElementTree.fromstring(webpage) + doc = xml.etree.ElementTree.fromstring(webpage.encode('utf-8')) if doc.tag == 'rss': return self._extract_rss(url, video_id, doc) - except xml.etree.ElementTree.ParseError: + except compat_xml_parse_error: pass # it's tempting to parse this further, but you would |