]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/franceinter.py
Update the changelog.
[youtubedl] / youtube_dl / extractor / franceinter.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..utils import int_or_none
6
7
8 class FranceInterIE(InfoExtractor):
9 _VALID_URL = r'https?://(?:www\.)?franceinter\.fr/player/reecouter\?play=(?P<id>[0-9]+)'
10 _TEST = {
11 'url': 'http://www.franceinter.fr/player/reecouter?play=793962',
12 'md5': '4764932e466e6f6c79c317d2e74f6884',
13 'info_dict': {
14 'id': '793962',
15 'ext': 'mp3',
16 'title': 'L’Histoire dans les jeux vidéo',
17 'description': 'md5:7e93ddb4451e7530022792240a3049c7',
18 'timestamp': 1387369800,
19 'upload_date': '20131218',
20 },
21 }
22
23 def _real_extract(self, url):
24 video_id = self._match_id(url)
25
26 webpage = self._download_webpage(url, video_id)
27
28 path = self._search_regex(
29 r'<a id="player".+?href="([^"]+)"', webpage, 'video url')
30 video_url = 'http://www.franceinter.fr/' + path
31
32 title = self._html_search_regex(
33 r'<span class="title-diffusion">(.+?)</span>', webpage, 'title')
34 description = self._html_search_regex(
35 r'<span class="description">(.*?)</span>',
36 webpage, 'description', fatal=False)
37 timestamp = int_or_none(self._search_regex(
38 r'data-date="(\d+)"', webpage, 'upload date', fatal=False))
39
40 return {
41 'id': video_id,
42 'title': title,
43 'description': description,
44 'timestamp': timestamp,
45 'formats': [{
46 'url': video_url,
47 'vcodec': 'none',
48 }],
49 }