3 from .common
import InfoExtractor
4 from ..compat
import compat_etree_fromstring
12 class FazIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?faz\.net/(?:[^/]+/)*.*?-(?P<id>\d+)\.html'
17 'url': 'http://www.faz.net/multimedia/videos/stockholm-chemie-nobelpreis-fuer-drei-amerikanische-forscher-12610585.html',
21 'title': 'Stockholm: Chemie-Nobelpreis für drei amerikanische Forscher',
22 'description': 'md5:1453fbf9a0d041d985a47306192ea253',
25 'url': 'http://www.faz.net/aktuell/politik/berlin-gabriel-besteht-zerreissprobe-ueber-datenspeicherung-13659345.html',
26 'only_matching': True,
28 'url': 'http://www.faz.net/berlin-gabriel-besteht-zerreissprobe-ueber-datenspeicherung-13659345.html',
29 'only_matching': True,
31 'url': 'http://www.faz.net/-13659345.html',
32 'only_matching': True,
34 'url': 'http://www.faz.net/aktuell/politik/-13659345.html',
35 'only_matching': True,
37 'url': 'http://www.faz.net/foobarblafasel-13659345.html',
38 'only_matching': True,
41 def _real_extract(self
, url
):
42 video_id
= self
._match
_id
(url
)
44 webpage
= self
._download
_webpage
(url
, video_id
)
45 description
= self
._og
_search
_description
(webpage
)
46 media
= self
._html
_search
_regex
(
47 r
"data-videojs-media='([^']+)",
50 perform_url
= self
._search
_regex
(
51 r
"<iframe[^>]+?src='((?:http:)?//player\.performgroup\.com/eplayer/eplayer\.html#/?[0-9a-f]{26}\.[0-9a-z]{26})",
52 webpage
, 'perform url')
53 return self
.url_result(perform_url
)
54 config
= compat_etree_fromstring(media
)
56 encodings
= xpath_element(config
, 'ENCODINGS', 'encodings', True)
58 for pref
, code
in enumerate(['LOW', 'HIGH', 'HQ']):
59 encoding
= xpath_element(encodings
, code
)
60 if encoding
is not None:
61 encoding_url
= xpath_text(encoding
, 'FILENAME')
63 tbr
= xpath_text(encoding
, 'AVERAGEBITRATE', 1000)
65 tbr
= int_or_none(tbr
.replace(',', '.'))
68 'format_id': code
.lower(),
71 'vcodec': xpath_text(encoding
, 'CODEC'),
73 mobj
= re
.search(r
'(\d+)x(\d+)_(\d+)\.mp4', encoding_url
)
76 'width': int(mobj
.group(1)),
77 'height': int(mobj
.group(2)),
78 'tbr': tbr
or int(mobj
.group(3)),
84 'title': self
._og
_search
_title
(webpage
),
86 'description': description
.strip() if description
else None,
87 'thumbnail': xpath_text(config
, 'STILL/STILL_BIG'),
88 'duration': int_or_none(xpath_text(config
, 'DURATION')),