]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/faz.py
3 import xml
.etree
.ElementTree
5 from .common
import InfoExtractor
9 get_element_by_attribute
,
13 class FazIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://www\.faz\.net/multimedia/videos/.*?-(?P<id>\d+).html'
18 u
'url': u
'http://www.faz.net/multimedia/videos/stockholm-chemie-nobelpreis-fuer-drei-amerikanische-forscher-12610585.html',
19 u
'file': u
'12610585.mp4',
21 u
'title': u
'Stockholm: Chemie-Nobelpreis für drei amerikanische Forscher',
22 u
'description': u
'md5:1453fbf9a0d041d985a47306192ea253',
26 def _real_extract(self
, url
):
27 mobj
= re
.match(self
._VALID
_URL
, url
)
28 video_id
= mobj
.group('id')
29 self
.to_screen(video_id
)
30 webpage
= self
._download
_webpage
(url
, video_id
)
31 config_xml_url
= self
._search
_regex
(r
'writeFLV\(\'(.+?
)\',', webpage,
33 config_xml = self._download_webpage(config_xml_url, video_id,
34 u'Downloading config xml
')
35 config = xml.etree.ElementTree.fromstring(config_xml.encode('utf
-8'))
37 encodings = config.find('ENCODINGS
')
39 for code in ['LOW
', 'HIGH
', 'HQ
']:
40 encoding = encodings.find(code)
43 encoding_url = encoding.find('FILENAME
').text
46 'ext
': determine_ext(encoding_url),
47 'format_id
': code.lower(),
50 descr_html = get_element_by_attribute('class', 'Content Copy
', webpage)
53 'title
': self._og_search_title(webpage),
55 'description
': clean_html(descr_html),
56 'thumbnail
': config.find('STILL
/STILL_BIG
').text,
58 # TODO: Remove when #980 has been merged
59 info.update(formats[-1])