]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/franceinter.py
Merge branch 'ustream-embed-recorded2' of https://github.com/anovicecodemonkey/youtub...
[youtube-dl] / youtube_dl / extractor / franceinter.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5
6 from .common import InfoExtractor
7
8
9 class FranceInterIE(InfoExtractor):
10     _VALID_URL = r'http://(?:www\.)?franceinter\.fr/player/reecouter\?play=(?P<id>[0-9]{6})'
11     _TEST = {
12         'url': 'http://www.franceinter.fr/player/reecouter?play=793962',
13         'file': '793962.mp3',
14         'md5': '4764932e466e6f6c79c317d2e74f6884',
15         "info_dict": {
16             "title": "L’Histoire dans les jeux vidéo",
17         },
18     }
19
20     def _real_extract(self, url):
21         mobj = re.match(self._VALID_URL, url)
22         video_id = mobj.group('id')
23
24         webpage = self._download_webpage(url, video_id)
25         title = self._html_search_regex(
26             r'<span class="roll_overflow">(.*?)</span></h1>', webpage, 'title')
27         path = self._search_regex(
28             r'&urlAOD=(.*?)&startTime', webpage, 'video url')
29         video_url = 'http://www.franceinter.fr/' + path
30
31         return {
32             'id': video_id,
33             'formats': [{
34                 'url': video_url,
35                 'vcodec': 'none',
36             }],
37             'title': title,
38         }