]>
Commit | Line | Data |
---|---|---|
63da13e8 | 1 | # encoding: utf-8 |
526b276f | 2 | from __future__ import unicode_literals |
63da13e8 JMF |
3 | |
4 | from .common import InfoExtractor | |
63da13e8 JMF |
5 | |
6 | ||
7 | class FazIE(InfoExtractor): | |
526b276f | 8 | IE_NAME = 'faz.net' |
c0ade33e | 9 | _VALID_URL = r'https?://www\.faz\.net/multimedia/videos/.*?-(?P<id>\d+)\.html' |
63da13e8 JMF |
10 | |
11 | _TEST = { | |
526b276f PH |
12 | 'url': 'http://www.faz.net/multimedia/videos/stockholm-chemie-nobelpreis-fuer-drei-amerikanische-forscher-12610585.html', |
13 | 'info_dict': { | |
14 | 'id': '12610585', | |
15 | 'ext': 'mp4', | |
16 | 'title': 'Stockholm: Chemie-Nobelpreis für drei amerikanische Forscher', | |
17 | 'description': 'md5:1453fbf9a0d041d985a47306192ea253', | |
63da13e8 JMF |
18 | }, |
19 | } | |
20 | ||
21 | def _real_extract(self, url): | |
526b276f PH |
22 | video_id = self._match_id(url) |
23 | ||
63da13e8 | 24 | webpage = self._download_webpage(url, video_id) |
526b276f PH |
25 | config_xml_url = self._search_regex( |
26 | r'writeFLV\(\'(.+?)\',', webpage, 'config xml url') | |
27 | config = self._download_xml( | |
28 | config_xml_url, video_id, 'Downloading config xml') | |
63da13e8 JMF |
29 | |
30 | encodings = config.find('ENCODINGS') | |
31 | formats = [] | |
526b276f | 32 | for pref, code in enumerate(['LOW', 'HIGH', 'HQ']): |
63da13e8 JMF |
33 | encoding = encodings.find(code) |
34 | if encoding is None: | |
35 | continue | |
36 | encoding_url = encoding.find('FILENAME').text | |
37 | formats.append({ | |
38 | 'url': encoding_url, | |
63da13e8 | 39 | 'format_id': code.lower(), |
526b276f | 40 | 'quality': pref, |
63da13e8 | 41 | }) |
526b276f | 42 | self._sort_formats(formats) |
63da13e8 | 43 | |
526b276f PH |
44 | descr = self._html_search_regex( |
45 | r'<p class="Content Copy">(.*?)</p>', webpage, 'description', fatal=False) | |
fb7abb31 | 46 | return { |
63da13e8 JMF |
47 | 'id': video_id, |
48 | 'title': self._og_search_title(webpage), | |
49 | 'formats': formats, | |
af4d506e | 50 | 'description': descr, |
63da13e8 JMF |
51 | 'thumbnail': config.find('STILL/STILL_BIG').text, |
52 | } |