]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/franceculture.py
b8fa175880f47d6050e4fa3908994bd9777131ac
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
(
34 r
'(?s)<div[^>]+class="[^"]*?(?:title-zone-diffusion|heading-zone-(?:wrapper|player-button))[^"]*?"[^>]*>.*?(<button[^>]+data-asset-source="[^"]+"[^>]+>)',
35 webpage
, 'video data'))
37 video_url
= video_data
['data-asset-source']
38 title
= video_data
.get('data-asset-title') or self
._og
_search
_title
(webpage
)
40 description
= self
._html
_search
_regex
(
41 r
'(?s)<div[^>]+class="intro"[^>]*>.*?<h2>(.+?)</h2>',
42 webpage
, 'description', default
=None)
43 thumbnail
= self
._search
_regex
(
44 r
'(?s)<figure[^>]+itemtype="https://schema.org/ImageObject"[^>]*>.*?<img[^>]+(?:data-dejavu-)?src="([^"]+)"',
45 webpage
, 'thumbnail', fatal
=False)
46 uploader
= self
._html
_search
_regex
(
47 r
'(?s)<span class="author">(.*?)</span>',
48 webpage
, 'uploader', default
=None)
49 ext
= determine_ext(video_url
.lower())
53 'display_id': display_id
,
56 'description': description
,
57 'thumbnail': thumbnail
,
59 'vcodec': 'none' if ext
== 'mp3' else None,
61 'timestamp': int_or_none(video_data
.get('data-asset-created-date')),
62 'duration': int_or_none(video_data
.get('data-duration')),