]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/franceculture.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
  14 class FranceCultureIE(InfoExtractor
): 
  15     _VALID_URL 
= r
'https?://(?:www\.)?franceculture\.fr/player/reecouter\?play=(?P<id>[0-9]+)' 
  17         'url': 'http://www.franceculture.fr/player/reecouter?play=4795174', 
  21             'title': 'Rendez-vous au pays des geeks', 
  22             'alt_title': 'Carnet nomade | 13-14', 
  24             'upload_date': '20140301', 
  25             'thumbnail': r
're:^http://www\.franceculture\.fr/.*/images/player/Carnet-nomade\.jpg$', 
  26             'description': 'startswith:Avec :Jean-Baptiste Péretié pour son documentaire sur Arte "La revanche des « geeks », une enquête menée aux Etats', 
  27             'timestamp': 1393700400, 
  31     def _real_extract(self
, url
): 
  32         video_id 
= self
._match
_id
(url
) 
  33         webpage 
= self
._download
_webpage
(url
, video_id
) 
  35         video_path 
= self
._search
_regex
( 
  36             r
'<a id="player".*?href="([^"]+)"', webpage
, 'video path') 
  37         video_url 
= compat_urlparse
.urljoin(url
, video_path
) 
  38         timestamp 
= int_or_none(self
._search
_regex
( 
  39             r
'<a id="player".*?data-date="([0-9]+)"', 
  40             webpage
, 'upload date', fatal
=False)) 
  41         thumbnail 
= self
._search
_regex
( 
  42             r
'<a id="player".*?>\s+<img src="([^"]+)"', 
  43             webpage
, 'thumbnail', fatal
=False) 
  45         title 
= self
._html
_search
_regex
( 
  46             r
'<span class="title-diffusion">(.*?)</span>', webpage
, 'title') 
  47         alt_title 
= self
._html
_search
_regex
( 
  48             r
'<span class="title">(.*?)</span>', 
  49             webpage
, 'alt_title', fatal
=False) 
  50         description 
= self
._html
_search
_regex
( 
  51             r
'<span class="description">(.*?)</span>', 
  52             webpage
, 'description', fatal
=False) 
  54         uploader 
= self
._html
_search
_regex
( 
  55             r
'(?s)<div id="emission".*?<span class="author">(.*?)</span>', 
  56             webpage
, 'uploader', default
=None) 
  57         vcodec 
= 'none' if determine_ext(video_url
.lower()) == 'mp3' else None 
  64             'timestamp': timestamp
, 
  66             'alt_title': alt_title
, 
  67             'thumbnail': thumbnail
, 
  68             'description': description
,