]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/bpb.py 
   2  from  __future__ 
import  unicode_literals
   6  from  . common 
import  InfoExtractor
  13  class  BpbIE ( InfoExtractor
):   14      IE_DESC 
=  'Bundeszentrale für politische Bildung'   15      _VALID_URL 
=  r
'https?://www\.bpb\.de/mediathek/(?P<id>[0-9]+)/'   18          'url' :  'http://www.bpb.de/mediathek/297/joachim-gauck-zu-1989-und-die-erinnerung-an-die-ddr' ,   19          # md5 fails in Python 2.6 due to buggy server response and wrong handling of urllib2   20          'md5' :  'c4f84c8a8044ca9ff68bb8441d300b3f' ,   24              'title' :  'Joachim Gauck zu 1989 und die Erinnerung an die DDR' ,   25              'description' :  'Joachim Gauck, erster Beauftragter für die Stasi-Unterlagen, spricht auf dem Geschichtsforum über die friedliche Revolution 1989 und eine "gewisse Traurigkeit" im Umgang mit der DDR-Vergangenheit.'   29      def  _real_extract ( self
,  url
):   30          video_id 
=  self
._ match
_ id
( url
)   31          webpage 
=  self
._ download
_ webpage
( url
,  video_id
)   33          title 
=  self
._ html
_ search
_ regex
(   34              r
'<h2 class="white">(.*?)</h2>' ,  webpage
,  'title' )   35          video_info_dicts 
=  re
. findall (   36              r
"({\s*src:\s*'http://film\.bpb\.de/[^}]+})" ,  webpage
)   39          for  video_info 
in  video_info_dicts
:   40              video_info 
=  self
._ parse
_ json
( video_info
,  video_id
,  transform_source
= js_to_json
)   41              quality 
=  video_info
[ 'quality' ]   42              video_url 
=  video_info
[ 'src' ]   45                  'preference' :  10  if  quality 
==  'high'  else  0 ,   46                  'format_note' :  quality
,   47                  'format_id' :  ' %s-%s '  % ( quality
,  determine_ext ( video_url
)),   50          self
._ sort
_ formats
( formats
)   56              'description' :  self
._ og
_ search
_ description
( webpage
),