2 from __future__ import unicode_literals
4 from .common import InfoExtractor
12 class FranceCultureIE(InfoExtractor):
13 _VALID_URL = r'https?://(?:www\.)?franceculture\.fr/emissions/(?:[^/]+/)*(?P<id>[^/?#&]+)'
15 'url': 'http://www.franceculture.fr/emissions/carnet-nomade/rendez-vous-au-pays-des-geeks',
17 'id': 'rendez-vous-au-pays-des-geeks',
18 'display_id': 'rendez-vous-au-pays-des-geeks',
20 'title': 'Rendez-vous au pays des geeks',
21 'thumbnail': r're:^https?://.*\.jpg$',
22 'upload_date': '20140301',
23 'timestamp': 1393700400,
28 'url': 'https://www.franceculture.fr/emissions/la-recherche-montre-en-main/la-recherche-montre-en-main-du-mercredi-10-octobre-2018',
29 'only_matching': True,
32 def _real_extract(self, url):
33 display_id = self._match_id(url)
35 webpage = self._download_webpage(url, display_id)
37 video_data = extract_attributes(self._search_regex(
41 <div[^>]+class="[^"]*?(?:title-zone-diffusion|heading-zone-(?:wrapper|player-button))[^"]*?"[^>]*>
43 (<button[^>]+data-(?:url|asset-source)="[^"]+"[^>]+>)
45 webpage, 'video data'))
47 video_url = video_data.get('data-url') or video_data['data-asset-source']
48 title = video_data.get('data-asset-title') or video_data.get('data-diffusion-title') or self._og_search_title(webpage)
50 description = self._html_search_regex(
51 r'(?s)<div[^>]+class="intro"[^>]*>.*?<h2>(.+?)</h2>',
52 webpage, 'description', default=None)
53 thumbnail = self._search_regex(
54 r'(?s)<figure[^>]+itemtype="https://schema.org/ImageObject"[^>]*>.*?<img[^>]+(?:data-dejavu-)?src="([^"]+)"',
55 webpage, 'thumbnail', default=None)
56 uploader = self._html_search_regex(
57 r'(?s)<span class="author">(.*?)</span>',
58 webpage, 'uploader', default=None)
59 ext = determine_ext(video_url.lower())
63 'display_id': display_id,
66 'description': description,
67 'thumbnail': thumbnail,
69 'vcodec': 'none' if ext == 'mp3' else None,
71 'timestamp': int_or_none(video_data.get('data-start-time')) or int_or_none(video_data.get('data-asset-created-date')),
72 'duration': int_or_none(video_data.get('data-duration')),