]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/franceinter.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
   7 from ..utils 
import int_or_none
 
  10 class FranceInterIE(InfoExtractor
): 
  11     _VALID_URL 
= r
'http://(?:www\.)?franceinter\.fr/player/reecouter\?play=(?P<id>[0-9]+)' 
  13         'url': 'http://www.franceinter.fr/player/reecouter?play=793962', 
  14         'md5': '4764932e466e6f6c79c317d2e74f6884', 
  18             'title': 'L’Histoire dans les jeux vidéo', 
  19             'description': 'md5:7e93ddb4451e7530022792240a3049c7', 
  20             'timestamp': 1387369800, 
  21             'upload_date': '20131218', 
  25     def _real_extract(self
, url
): 
  26         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  27         video_id 
= mobj
.group('id') 
  29         webpage 
= self
._download
_webpage
(url
, video_id
) 
  31         path 
= self
._search
_regex
( 
  32             r
'<a id="player".+?href="([^"]+)"', webpage
, 'video url') 
  33         video_url 
= 'http://www.franceinter.fr/' + path
 
  35         title 
= self
._html
_search
_regex
( 
  36             r
'<span class="title">(.+?)</span>', webpage
, 'title') 
  37         description 
= self
._html
_search
_regex
( 
  38             r
'<span class="description">(.*?)</span>', 
  39             webpage
, 'description', fatal
=False) 
  40         timestamp 
= int_or_none(self
._search
_regex
( 
  41             r
'data-date="(\d+)"', webpage
, 'upload date', fatal
=False)) 
  46             'description': description
, 
  47             'timestamp': timestamp
,