]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/franceinter.py
Add support for https for all extractors as preventive and future-proof measure
[yt-dlp.git] / youtube_dl / extractor / franceinter.py
CommitLineData
677b3ce8 1# coding: utf-8
c8650f7e 2from __future__ import unicode_literals
3
bf6705f5 4from .common import InfoExtractor
532f5bff 5from ..utils import int_or_none
677b3ce8
PH
6
7
bf6705f5 8class FranceInterIE(InfoExtractor):
5886b38d 9 _VALID_URL = r'https?://(?:www\.)?franceinter\.fr/player/reecouter\?play=(?P<id>[0-9]+)'
677b3ce8
PH
10 _TEST = {
11 'url': 'http://www.franceinter.fr/player/reecouter?play=793962',
677b3ce8 12 'md5': '4764932e466e6f6c79c317d2e74f6884',
611c1dd9 13 'info_dict': {
532f5bff
S
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',
677b3ce8
PH
20 },
21 }
bf6705f5 22
677b3ce8 23 def _real_extract(self, url):
2db58069 24 video_id = self._match_id(url)
26844eb5 25
677b3ce8 26 webpage = self._download_webpage(url, video_id)
532f5bff 27
677b3ce8 28 path = self._search_regex(
532f5bff 29 r'<a id="player".+?href="([^"]+)"', webpage, 'video url')
677b3ce8
PH
30 video_url = 'http://www.franceinter.fr/' + path
31
532f5bff 32 title = self._html_search_regex(
220bc3f0 33 r'<span class="title-diffusion">(.+?)</span>', webpage, 'title')
532f5bff
S
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
677b3ce8
PH
40 return {
41 'id': video_id,
532f5bff
S
42 'title': title,
43 'description': description,
44 'timestamp': timestamp,
677b3ce8
PH
45 'formats': [{
46 'url': video_url,
47 'vcodec': 'none',
48 }],
677b3ce8 49 }