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': 1393642916,
28 def _real_extract(self, url):
29 display_id = self._match_id(url)
31 webpage = self._download_webpage(url, display_id)
33 video_data = extract_attributes(self._search_regex(
37 <div[^>]+class="[^"]*?(?:title-zone-diffusion|heading-zone-(?:wrapper|player-button))[^"]*?"[^>]*>
39 (<button[^>]+data-asset-source="[^"]+"[^>]+>)
41 webpage, 'video data'))
43 video_url = video_data['data-asset-source']
44 title = video_data.get('data-asset-title') or self._og_search_title(webpage)
46 description = self._html_search_regex(
47 r'(?s)<div[^>]+class="intro"[^>]*>.*?<h2>(.+?)</h2>',
48 webpage, 'description', default=None)
49 thumbnail = self._search_regex(
50 r'(?s)<figure[^>]+itemtype="https://schema.org/ImageObject"[^>]*>.*?<img[^>]+(?:data-dejavu-)?src="([^"]+)"',
51 webpage, 'thumbnail', fatal=False)
52 uploader = self._html_search_regex(
53 r'(?s)<span class="author">(.*?)</span>',
54 webpage, 'uploader', default=None)
55 ext = determine_ext(video_url.lower())
59 'display_id': display_id,
62 'description': description,
63 'thumbnail': thumbnail,
65 'vcodec': 'none' if ext == 'mp3' else None,
67 'timestamp': int_or_none(video_data.get('data-asset-created-date')),
68 'duration': int_or_none(video_data.get('data-duration')),