diff options
author | Sergey M․ <dstftw@gmail.com> | 2014-08-26 20:07:28 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2014-08-26 20:07:28 +0700 |
commit | c7bee2a7254d31b7c478c0ac33bf23bdeba1c53c (patch) | |
tree | 70b2a29c5e4cd1c13f0b13902d7d52cb3f451d87 | |
parent | dbc1366b502db813a27aaa9ab2fa5148749ac659 (diff) |
[empflix] Adapt to malformed config XML
-rw-r--r-- | youtube_dl/extractor/empflix.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/youtube_dl/extractor/empflix.py b/youtube_dl/extractor/empflix.py index e6952588f..1290cd9f7 100644 --- a/youtube_dl/extractor/empflix.py +++ b/youtube_dl/extractor/empflix.py @@ -35,14 +35,16 @@ class EmpflixIE(InfoExtractor): r'flashvars\.config = escape\("([^"]+)"', webpage, 'flashvars.config') - cfg_xml = self._download_xml( + # XML is malformed + cfg_xml = self._download_webpage( cfg_url, video_id, note='Downloading metadata') formats = [ { - 'url': item.find('videoLink').text, - 'format_id': item.find('res').text, - } for item in cfg_xml.findall('./quality/item') + 'url': item[1], + 'format_id': item[0], + } for item in re.findall( + r'<item>\s*<res>([^>]+)</res>\s*<videoLink>([^<]+)</videoLink>\s*</item>', cfg_xml) ] return { |