3 from __future__
import unicode_literals
8 from .common
import InfoExtractor
14 class FranceTVBaseInfoExtractor(InfoExtractor
):
15 def _extract_video(self
, video_id
):
16 info
= self
._download
_xml
(
17 'http://www.francetvinfo.fr/appftv/webservices/video/'
18 'getInfosOeuvre.php?id-diffusion='
19 + video_id
, video_id
, 'Downloading XML config')
21 manifest_url
= info
.find('videos/video/url').text
22 video_url
= manifest_url
.replace('manifest.f4m', 'index_2_av.m3u8')
23 video_url
= video_url
.replace('/z/', '/i/')
24 thumbnail_path
= info
.find('image').text
26 return {'id': video_id
,
27 'ext': 'flv' if video_url
.startswith('rtmp') else 'mp4',
29 'title': info
.find('titre').text
,
30 'thumbnail': compat_urlparse
.urljoin('http://pluzz.francetv.fr', thumbnail_path
),
31 'description': info
.find('synopsis').text
,
35 class PluzzIE(FranceTVBaseInfoExtractor
):
36 IE_NAME
= 'pluzz.francetv.fr'
37 _VALID_URL
= r
'https?://pluzz\.francetv\.fr/videos/(.*?)\.html'
39 # Can't use tests, videos expire in 7 days
41 def _real_extract(self
, url
):
42 title
= re
.match(self
._VALID
_URL
, url
).group(1)
43 webpage
= self
._download
_webpage
(url
, title
)
44 video_id
= self
._search
_regex
(
45 r
'data-diffusion="(\d+)"', webpage
, 'ID')
46 return self
._extract
_video
(video_id
)
49 class FranceTvInfoIE(FranceTVBaseInfoExtractor
):
50 IE_NAME
= 'francetvinfo.fr'
51 _VALID_URL
= r
'https?://www\.francetvinfo\.fr/replay.*/(?P<title>.+)\.html'
54 'url': 'http://www.francetvinfo.fr/replay-jt/france-3/soir-3/jt-grand-soir-3-lundi-26-aout-2013_393427.html',
55 'file': '84981923.mp4',
60 'skip_download': True,
64 def _real_extract(self
, url
):
65 mobj
= re
.match(self
._VALID
_URL
, url
)
66 page_title
= mobj
.group('title')
67 webpage
= self
._download
_webpage
(url
, page_title
)
68 video_id
= self
._search
_regex
(r
'id-video=(\d+?)[@"]', webpage
, 'video id')
69 return self
._extract
_video
(video_id
)
72 class FranceTVIE(FranceTVBaseInfoExtractor
):
74 IE_DESC
= 'France 2, 3, 4, 5 and Ô'
75 _VALID_URL
= r
'''(?x)https?://www\.france[2345o]\.fr/
77 emissions/.*?/(videos|emissions)/(?P<id>[^/?]+)
78 | (emissions?|jt)/(?P<key>[^/?]+)
84 'url': 'http://www.france2.fr/emissions/13h15-le-samedi-le-dimanche/videos/75540104',
85 'file': '75540104.mp4',
87 'title': '13h15, le samedi...',
88 'description': 'md5:2e5b58ba7a2d3692b35c792be081a03d',
92 'skip_download': True,
97 'url': 'http://www.france3.fr/emissions/pieces-a-conviction/diffusions/13-11-2013_145575',
99 'id': '000702326_CAPP_PicesconvictionExtrait313022013_120220131722_Au',
101 'title': 'Le scandale du prix des médicaments',
102 'description': 'md5:1384089fbee2f04fc6c9de025ee2e9ce',
106 'skip_download': True,
111 'url': 'http://www.france4.fr/emissions/hero-corp/videos/rhozet_herocorp_bonus_1_20131106_1923_06112013172108_F4',
113 'id': 'rhozet_herocorp_bonus_1_20131106_1923_06112013172108_F4',
115 'title': 'Hero Corp Making of - Extrait 1',
116 'description': 'md5:c87d54871b1790679aec1197e73d650a',
120 'skip_download': True,
125 'url': 'http://www.france5.fr/emissions/c-a-dire/videos/92837968',
129 'title': 'C à dire ?!',
130 'description': 'md5:fb1db1cbad784dcce7c7a7bd177c8e2f',
134 'skip_download': True,
139 'url': 'http://www.franceo.fr/jt/info-afrique/04-12-2013',
143 'title': 'Infô-Afrique',
144 'description': 'md5:ebf346da789428841bee0fd2a935ea55',
148 'skip_download': True,
150 'skip': 'The id changes frequently',
154 def _real_extract(self
, url
):
155 mobj
= re
.match(self
._VALID
_URL
, url
)
156 if mobj
.group('key'):
157 webpage
= self
._download
_webpage
(url
, mobj
.group('key'))
159 (r
'''(?x)<div\s+class="video-player">\s*
160 <a\s+href="http://videos.francetv.fr/video/([0-9]+)"\s+
161 class="francetv-video-player">'''),
162 (r
'<a id="player_direct" href="http://info\.francetelevisions'
163 '\.fr/\?id-video=([^"/&]+)'),
164 (r
'<a class="video" id="ftv_player_(.+?)"'),
166 video_id
= self
._html
_search
_regex
(id_res
, webpage
, 'video ID')
168 video_id
= mobj
.group('id')
169 return self
._extract
_video
(video_id
)
172 class GenerationQuoiIE(InfoExtractor
):
173 IE_NAME
= 'france2.fr:generation-quoi'
174 _VALID_URL
= r
'https?://generation-quoi\.france2\.fr/portrait/(?P<name>.*)(\?|$)'
177 'url': 'http://generation-quoi.france2.fr/portrait/garde-a-vous',
178 'file': 'k7FJX8VBcvvLmX4wA5Q.mp4',
180 'title': 'Génération Quoi - Garde à Vous',
181 'uploader': 'Génération Quoi',
184 # It uses Dailymotion
185 'skip_download': True,
187 'skip': 'Only available from France',
190 def _real_extract(self
, url
):
191 mobj
= re
.match(self
._VALID
_URL
, url
)
192 name
= mobj
.group('name')
193 info_url
= compat_urlparse
.urljoin(url
, '/medias/video/%s.json' % name
)
194 info_json
= self
._download
_webpage
(info_url
, name
)
195 info
= json
.loads(info_json
)
196 return self
.url_result('http://www.dailymotion.com/video/%s' % info
['id'],
200 class CultureboxIE(FranceTVBaseInfoExtractor
):
201 IE_NAME
= 'culturebox.francetvinfo.fr'
202 _VALID_URL
= r
'https?://culturebox\.francetvinfo\.fr/(?P<name>.*?)(\?|$)'
205 'url': 'http://culturebox.francetvinfo.fr/einstein-on-the-beach-au-theatre-du-chatelet-146813',
209 'title': 'Einstein on the beach au Théâtre du Châtelet',
210 'description': 'md5:9ce2888b1efefc617b5e58b3f6200eeb',
214 'skip_download': True,
218 def _real_extract(self
, url
):
219 mobj
= re
.match(self
._VALID
_URL
, url
)
220 name
= mobj
.group('name')
221 webpage
= self
._download
_webpage
(url
, name
)
222 video_id
= self
._search
_regex
(r
'"http://videos\.francetv\.fr/video/(.*?)"', webpage
, 'video id')
223 return self
._extract
_video
(video_id
)