]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/radiofrance.py
Update changelog.
[youtubedl] / youtube_dl / extractor / radiofrance.py
1 # coding: utf-8
2 import re
3
4 from .common import InfoExtractor
5
6
7 class RadioFranceIE(InfoExtractor):
8 _VALID_URL = r'^https?://maison\.radiofrance\.fr/radiovisions/(?P<id>[^?#]+)'
9 IE_NAME = u'radiofrance'
10
11 _TEST = {
12 u'url': u'http://maison.radiofrance.fr/radiovisions/one-one',
13 u'file': u'one-one.ogg',
14 u'md5': u'bdbb28ace95ed0e04faab32ba3160daf',
15 u'info_dict': {
16 u"title": u"One to one",
17 u"description": u"Plutôt que d'imaginer la radio de demain comme technologie ou comme création de contenu, je veux montrer que quelles que soient ses évolutions, j'ai l'intime conviction que la radio continuera d'être un grand média de proximité pour les auditeurs.",
18 u"uploader": u"Thomas Hercouët",
19 },
20 }
21
22 def _real_extract(self, url):
23 m = re.match(self._VALID_URL, url)
24 video_id = m.group('id')
25
26 webpage = self._download_webpage(url, video_id)
27 title = self._html_search_regex(r'<h1>(.*?)</h1>', webpage, u'title')
28 description = self._html_search_regex(
29 r'<div class="bloc_page_wrapper"><div class="text">(.*?)</div>',
30 webpage, u'description', fatal=False)
31 uploader = self._html_search_regex(
32 r'<div class="credit">&nbsp;&nbsp;&copy;&nbsp;(.*?)</div>',
33 webpage, u'uploader', fatal=False)
34
35 formats_str = self._html_search_regex(
36 r'class="jp-jplayer[^"]*" data-source="([^"]+)">',
37 webpage, u'audio URLs')
38 formats = [
39 {
40 'format_id': fm[0],
41 'url': fm[1],
42 'vcodec': 'none',
43 }
44 for fm in
45 re.findall(r"([a-z0-9]+)\s*:\s*'([^']+)'", formats_str)
46 ]
47 # No sorting, we don't know any more about these formats
48
49 return {
50 'id': video_id,
51 'title': title,
52 'formats': formats,
53 'description': description,
54 'uploader': uploader,
55 }