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'https?://www\.france2\.fr/emissions/.*?/videos/(?P<id>\d+)'
76 u'url': u'http://www.france2.fr/emissions/13h15-le-samedi-le-dimanche/videos/75540104',
77 u'file': u'75540104.mp4',
79 u'title': u'13h15, le samedi...',
80 u'description': u'md5:2e5b58ba7a2d3692b35c792be081a03d',
83 u'skip_download': True,
87 def _real_extract(self, url):
88 mobj = re.match(self._VALID_URL, url)
89 video_id = mobj.group('id')
90 return self._extract_video(video_id)
93 class GenerationQuoiIE(InfoExtractor):
94 IE_NAME = u'http://generation-quoi.france2.fr'
95 _VALID_URL = r'https?://generation-quoi\.france2\.fr/portrait/(?P<name>.*)(\?|$)'
98 u'url': u'http://generation-quoi.france2.fr/portrait/garde-a-vous',
99 u'file': u'k7FJX8VBcvvLmX4wA5Q.mp4',
101 u'title': u'Génération Quoi - Garde à Vous',
102 u'uploader': u'Génération Quoi',
105 # It uses Dailymotion
106 u'skip_download': True,
110 def _real_extract(self, url):
111 mobj = re.match(self._VALID_URL, url)
112 name = mobj.group('name')
113 info_url = compat_urlparse.urljoin(url, '/medias/video/%s.json' % name)
114 info_json = self._download_webpage(info_url, name)
115 info = json.loads(info_json)
116 return self.url_result('http://www.dailymotion.com/video/%s' % info['id'],