Browse Source

[empflix] Adapt to malformed config XML

master
Sergey M․ 10 years ago
parent
commit
c7bee2a725
1 changed files with 6 additions and 4 deletions
  1. 10
      youtube_dl/extractor/empflix.py

10
youtube_dl/extractor/empflix.py

@ -35,14 +35,16 @@ class EmpflixIE(InfoExtractor):
r'flashvars\.config = escape\("([^"]+)"', r'flashvars\.config = escape\("([^"]+)"',
webpage, 'flashvars.config') webpage, 'flashvars.config')
cfg_xml = self._download_xml(
# XML is malformed
cfg_xml = self._download_webpage(
cfg_url, video_id, note='Downloading metadata') cfg_url, video_id, note='Downloading metadata')
formats = [ 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 { return {

Loading…
Cancel
Save