diff options
| author | Philipp Hagemeister <phihag@phihag.de> | 2013-12-16 21:34:41 +0100 | 
|---|---|---|
| committer | Philipp Hagemeister <phihag@phihag.de> | 2013-12-16 21:34:41 +0100 | 
| commit | 0e2a436dcebc7dc17c5848bada4adcad4248491d (patch) | |
| tree | 1f8a7b37ce8e820aec30bcb5272f6a16acbf80a3 | |
| parent | 24050dd11c0fe46136344cdcccedfef0d0b260c3 (diff) | |
[radiofrance] Add support (Fixes #1942)
| -rw-r--r-- | youtube_dl/extractor/__init__.py | 1 | ||||
| -rw-r--r-- | youtube_dl/extractor/radiofrance.py | 60 | 
2 files changed, 61 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index b8ff750d0..2761b5439 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -119,6 +119,7 @@ from .pornhd import PornHdIE  from .pornhub import PornHubIE  from .pornotube import PornotubeIE  from .pyvideo import PyvideoIE +from .radiofrance import RadioFranceIE  from .rbmaradio import RBMARadioIE  from .redtube import RedTubeIE  from .ringtv import RingTVIE diff --git a/youtube_dl/extractor/radiofrance.py b/youtube_dl/extractor/radiofrance.py new file mode 100644 index 000000000..bb33b50bc --- /dev/null +++ b/youtube_dl/extractor/radiofrance.py @@ -0,0 +1,60 @@ +# coding: utf-8 +import datetime +import json +import re + +from .common import InfoExtractor +from ..utils import ( +    remove_start, +) + + +class RadioFranceIE(InfoExtractor): +    _VALID_URL = r'^https?://maison\.radiofrance\.fr/radiovisions/(?P<id>[^?#]+)' +    IE_NAME = u'radiofrance' + +    _TEST = { +        u'url': u'http://maison.radiofrance.fr/radiovisions/one-one', +        u'file': u'one-one.mp4', +        u'md5': u'todo', +        u'info_dict': { +            u"title": u"One to one", +            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.", +            u"uploader": u"ferdi", +        }, +    } + +    def _real_extract(self, url): +        m = re.match(self._VALID_URL, url) +        video_id = m.group('id') + +        webpage = self._download_webpage(url, video_id) +        title = self._html_search_regex(r'<h1>(.*?)</h1>', webpage, u'title') +        description = self._html_search_regex( +            r'<div class="bloc_page_wrapper"><div class="text">(.*?)</div>', +            webpage, u'description', fatal=False) +        uploader = self._html_search_regex( +            r'<div class="credit">  © (.*?)</div>', +            webpage, u'uploader', fatal=False) + +        formats_str = self._html_search_regex( +            r'class="jp-jplayer[^"]*" data-source="([^"]+)">', +            webpage, u'audio URLs') +        formats = [ +            { +                'format_id': m[0], +                'url': m[1], +                'vcodec': 'none', +            } +            for m in +            re.findall(r"([a-z0-9]+)\s*:\s*'([^']+)'", formats_str) +        ] +        # No sorting, we don't know any more about these formats + +        return { +            'id': video_id, +            'title': title, +            'formats': formats, +            'description': description, +            'uploader': uploader, +        }  | 
