]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/radiobremen.py 
   1  # -*- coding: utf-8 -*-    3  from  __future__ 
import  unicode_literals
   7  from  . common 
import  InfoExtractor
   8  from  .. utils 
import  parse_duration
  11  class  RadioBremenIE ( InfoExtractor
):   12      _VALID_URL 
=  r
'http?://(?:www\.)?radiobremen\.de/mediathek/(?:index\.html)?\?id=(?P<id>[0-9]+)'   13      IE_NAME 
=  'radiobremen'   16          'url' :  'http://www.radiobremen.de/mediathek/index.html?id=114720' ,   22              'title' :  'buten un binnen vom 22. Dezember' ,   23              'thumbnail' :  're:https?://.*\.jpg$' ,   24              'description' :  'Unter anderem mit diesen Themen: 45 Flüchtlinge sind in Worpswede angekommen +++ Freies Internet für alle: Bremer arbeiten an einem flächendeckenden W-Lan-Netzwerk +++ Aktivisten kämpfen für das Unibad +++ So war das Wetter 2014 +++' ,   28      def  _real_extract ( self
,  url
):   29          video_id 
=  self
._ match
_ id
( url
)   31          meta_url 
=  'http://www.radiobremen.de/apps/php/mediathek/metadaten.php?id= %s '  %  video_id
  32          meta_doc 
=  self
._ download
_ webpage
(   33              meta_url
,  video_id
,  'Downloading metadata' )   34          title 
=  self
._ html
_ search
_ regex
(   35              r
'<h1.*>(?P<title>.+)</h1>' ,  meta_doc
,  'title' )   36          description 
=  self
._ html
_ search
_ regex
(   37              r
'<p>(?P<description>.*)</p>' ,  meta_doc
,  'description' ,  fatal
= False )   38          duration 
=  parse_duration ( self
._ html
_ search
_ regex
(   39              r
'Länge:</td>\s+<td>(?P<duration>[0-9]+:[0-9]+)</td>' ,   40              meta_doc
,  'duration' ,  fatal
= False ))   42          page_doc 
=  self
._ download
_ webpage
(   43              url
,  video_id
,  'Downloading video information' )   45              r
"ardformatplayerclassic\(\'playerbereich\',\'(?P<width>[0-9]+)\',\'.*\',\'(?P<video_id>[0-9]+)\',\'(?P<secret>[0-9]+)\',\'(?P<thumbnail>.+)\',\'\'\)" ,   48              "http://dl-ondemand.radiobremen.de/mediabase/ %s / %s _ %s _ %s .mp4"  %   49              ( video_id
,  video_id
,  mobj
. group ( "secret" ),  mobj
. group ( 'width' )))   54              'width' :  int ( mobj
. group ( 'width' )),   59              'description' :  description
,   62              'thumbnail' :  mobj
. group ( 'thumbnail' ),