]>
Commit | Line | Data |
---|---|---|
677b3ce8 | 1 | # coding: utf-8 |
c8650f7e | 2 | from __future__ import unicode_literals |
3 | ||
bf6705f5 | 4 | from .common import InfoExtractor |
0002962f | 5 | from ..utils import month_by_name |
677b3ce8 PH |
6 | |
7 | ||
bf6705f5 | 8 | class FranceInterIE(InfoExtractor): |
a942d6cb | 9 | _VALID_URL = r'https?://(?:www\.)?franceinter\.fr/emissions/(?P<id>[^?#]+)' |
10 | ||
677b3ce8 | 11 | _TEST = { |
c51a7f0b S |
12 | 'url': 'https://www.franceinter.fr/emissions/affaires-sensibles/affaires-sensibles-07-septembre-2016', |
13 | 'md5': '9e54d7bdb6fdc02a841007f8a975c094', | |
611c1dd9 | 14 | 'info_dict': { |
c51a7f0b | 15 | 'id': 'affaires-sensibles/affaires-sensibles-07-septembre-2016', |
532f5bff | 16 | 'ext': 'mp3', |
c51a7f0b S |
17 | 'title': 'Affaire Cahuzac : le contentieux du compte en Suisse', |
18 | 'description': 'md5:401969c5d318c061f86bda1fa359292b', | |
19 | 'upload_date': '20160907', | |
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 | |
a942d6cb | 28 | video_url = self._search_regex( |
0002962f S |
29 | r'(?s)<div[^>]+class=["\']page-diffusion["\'][^>]*>.*?<button[^>]+data-url=(["\'])(?P<url>(?:(?!\1).)+)\1', |
30 | webpage, 'video url', group='url') | |
a942d6cb | 31 | |
32 | title = self._og_search_title(webpage) | |
33 | description = self._og_search_description(webpage) | |
34 | ||
0002962f | 35 | upload_date_str = self._search_regex( |
b2a027fc | 36 | r'class=["\']\s*cover-emission-period\s*["\'][^>]*>[^<]+\s+(\d{1,2}\s+[^\s]+\s+\d{4})<', |
0002962f S |
37 | webpage, 'upload date', fatal=False) |
38 | if upload_date_str: | |
39 | upload_date_list = upload_date_str.split() | |
40 | upload_date_list.reverse() | |
52dc8a9b | 41 | upload_date_list[1] = '%02d' % (month_by_name(upload_date_list[1], lang='fr') or 0) |
c51a7f0b | 42 | upload_date_list[2] = '%02d' % int(upload_date_list[2]) |
0002962f S |
43 | upload_date = ''.join(upload_date_list) |
44 | else: | |
45 | upload_date = None | |
532f5bff | 46 | |
677b3ce8 PH |
47 | return { |
48 | 'id': video_id, | |
532f5bff S |
49 | 'title': title, |
50 | 'description': description, | |
0002962f | 51 | 'upload_date': upload_date, |
677b3ce8 PH |
52 | 'formats': [{ |
53 | 'url': video_url, | |
54 | 'vcodec': 'none', | |
55 | }], | |
677b3ce8 | 56 | } |