3 import xml
.etree
.ElementTree
6 from .common
import InfoExtractor
12 class FranceTVBaseInfoExtractor(InfoExtractor
):
13 def _extract_video(self
, video_id
):
14 xml_desc
= self
._download
_webpage
(
15 'http://www.francetvinfo.fr/appftv/webservices/video/'
16 'getInfosOeuvre.php?id-diffusion='
17 + video_id
, video_id
, 'Downloading XML config')
18 info
= xml
.etree
.ElementTree
.fromstring(xml_desc
.encode('utf-8'))
20 manifest_url
= info
.find('videos/video/url').text
21 video_url
= manifest_url
.replace('manifest.f4m', 'index_2_av.m3u8')
22 video_url
= video_url
.replace('/z/', '/i/')
23 thumbnail_path
= info
.find('image').text
25 return {'id': video_id
,
28 'title': info
.find('titre').text
,
29 'thumbnail': compat_urlparse
.urljoin('http://pluzz.francetv.fr', thumbnail_path
),
30 'description': info
.find('synopsis').text
,
34 class PluzzIE(FranceTVBaseInfoExtractor
):
35 IE_NAME
= u
'pluzz.francetv.fr'
36 _VALID_URL
= r
'https?://pluzz\.francetv\.fr/videos/(.*?)\.html'
38 # Can't use tests, videos expire in 7 days
40 def _real_extract(self
, url
):
41 title
= re
.match(self
._VALID
_URL
, url
).group(1)
42 webpage
= self
._download
_webpage
(url
, title
)
43 video_id
= self
._search
_regex
(
44 r
'data-diffusion="(\d+)"', webpage
, 'ID')
45 return self
._extract
_video
(video_id
)
48 class FranceTvInfoIE(FranceTVBaseInfoExtractor
):
49 IE_NAME
= u
'francetvinfo.fr'
50 _VALID_URL
= r
'https?://www\.francetvinfo\.fr/replay.*/(?P<title>.+).html'
53 u
'url': u
'http://www.francetvinfo.fr/replay-jt/france-3/soir-3/jt-grand-soir-3-lundi-26-aout-2013_393427.html',
54 u
'file': u
'84981923.mp4',
59 u
'skip_download': True,
63 def _real_extract(self
, url
):
64 mobj
= re
.match(self
._VALID
_URL
, url
)
65 page_title
= mobj
.group('title')
66 webpage
= self
._download
_webpage
(url
, page_title
)
67 video_id
= self
._search
_regex
(r
'id-video=(\d+?)"', webpage
, u
'video id')
68 return self
._extract
_video
(video_id
)
71 class France2IE(FranceTVBaseInfoExtractor
):
72 IE_NAME
= u
'france2.fr'
73 _VALID_URL
= r
'''(?x)https?://www\.france2\.fr/
75 emissions/.*?/videos/(?P<id>\d+)
76 | emission/(?P<key>[^/?]+)
80 u
'url': u
'http://www.france2.fr/emissions/13h15-le-samedi-le-dimanche/videos/75540104',
81 u
'file': u
'75540104.mp4',
83 u
'title': u
'13h15, le samedi...',
84 u
'description': u
'md5:2e5b58ba7a2d3692b35c792be081a03d',
87 u
'skip_download': True,
91 def _real_extract(self
, url
):
92 mobj
= re
.match(self
._VALID
_URL
, url
)
94 webpage
= self
._download
_webpage
(url
, mobj
.group('key'))
95 video_id
= self
._html
_search
_regex
(
96 r
'''(?x)<div\s+class="video-player">\s*
97 <a\s+href="http://videos.francetv.fr/video/([0-9]+)"\s+
98 class="francetv-video-player">''',
101 video_id
= mobj
.group('id')
102 return self
._extract
_video
(video_id
)
105 class GenerationQuoiIE(InfoExtractor
):
106 IE_NAME
= u
'http://generation-quoi.france2.fr'
107 _VALID_URL
= r
'https?://generation-quoi\.france2\.fr/portrait/(?P<name>.*)(\?|$)'
110 u
'url': u
'http://generation-quoi.france2.fr/portrait/garde-a-vous',
111 u
'file': u
'k7FJX8VBcvvLmX4wA5Q.mp4',
113 u
'title': u
'Génération Quoi - Garde à Vous',
114 u
'uploader': u
'Génération Quoi',
117 # It uses Dailymotion
118 u
'skip_download': True,
122 def _real_extract(self
, url
):
123 mobj
= re
.match(self
._VALID
_URL
, url
)
124 name
= mobj
.group('name')
125 info_url
= compat_urlparse
.urljoin(url
, '/medias/video/%s.json' % name
)
126 info_json
= self
._download
_webpage
(info_url
, name
)
127 info
= json
.loads(info_json
)
128 return self
.url_result('http://www.dailymotion.com/video/%s' % info
['id'],