[empflix] Adapt to malformed config XML
authorSergey M․ <dstftw@gmail.com>
Tue, 26 Aug 2014 13:07:28 +0000 (20:07 +0700)
committerSergey M․ <dstftw@gmail.com>
Tue, 26 Aug 2014 13:07:28 +0000 (20:07 +0700)
youtube_dl/extractor/empflix.py

index e6952588fbdfa08167935fc2b1c0381804328943..1290cd9f7028aace78fc104cceb76b33da6752ca 100644 (file)
@@ -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 {