]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cbc.py 
ff663d07947fd345a107203892cbe1811080ac6c
   2  from  __future__ 
import  unicode_literals
   6  from  . common 
import  InfoExtractor
  13  class  CBCIE ( InfoExtractor
):   14      _VALID_URL 
=  r
'https?://(?:www\.)?cbc\.ca/(?!player/)(?:[^/]+/)+(?P<id>[^/?#]+)'   17          'url' :  'http://www.cbc.ca/22minutes/videos/clips-season-23/don-cherry-play-offs' ,   18          'md5' :  '97e24d09672fc4cf56256d6faa6c25bc' ,   22              'title' :  'Don Cherry – All-Stars' ,   23              'description' :  'Don Cherry has a bee in his bonnet about AHL player John Scott because that guy’s got heart.' ,   24              'timestamp' :  1454463000 ,   25              'upload_date' :  '20160203' ,   26              'uploader' :  'CBCC-NEW' ,   30          'url' :  'http://www.cbc.ca/archives/entry/1978-robin-williams-freestyles-on-90-minutes-live' ,   31          'md5' :  '0274a90b51a9b4971fe005c63f592f12' ,   35              'title' :  'Robin Williams freestyles on 90 Minutes Live' ,   36              'description' :  'Wacky American comedian Robin Williams shows off his infamous "freestyle" comedic talents while being interviewed on CBC \' s 90 Minutes Live.' ,   37              'upload_date' :  '19780210' ,   38              'uploader' :  'CBCC-NEW' ,   39              'timestamp' :  255977160 ,   43          'url' :  'http://www.cbc.ca/natureofthings/blog/birds-eye-view-from-vancouvers-burrard-street-bridge-how-we-got-the-shot' ,   45              'md5' :  '377572d0b49c4ce0c9ad77470e0b96b4' ,   49                  'title' :  'An Eagle \' s-Eye View Off Burrard Bridge' ,   50                  'description' :  'Hercules the eagle flies from Vancouver \' s Burrard Bridge down to a nearby park with a mini-camera strapped to his back.' ,   51                  'upload_date' :  '20160201' ,   52                  'timestamp' :  1454342820 ,   53                  'uploader' :  'CBCC-NEW' ,   56              'md5' :  '415a0e3f586113894174dfb31aa5bb1a' ,   60                  'title' :  'Fly like an eagle!' ,   61                  'description' :  'Eagle equipped with a mini camera flies from the world \' s tallest tower' ,   62                  'upload_date' :  '20150315' ,   63                  'timestamp' :  1426443984 ,   64                  'uploader' :  'CBCC-NEW' ,   70      def  suitable ( cls
,  url
):   71          return False if  CBCPlayerIE
. suitable ( url
)  else  super ( CBCIE
,  cls
). suitable ( url
)   73      def  _real_extract ( self
,  url
):   74          display_id 
=  self
._ match
_ id
( url
)   75          webpage 
=  self
._ download
_ webpage
( url
,  display_id
)   76          player_init 
=  self
._ search
_ regex
(   77              r
'CBC\.APP\.Caffeine\.initInstance\(({.+?})\);' ,  webpage
,  'player init' ,   80              player_info 
=  self
._ parse
_ json
( player_init
,  display_id
,  js_to_json
)   81              media_id 
=  player_info
. get ( 'mediaId' )   83                  clip_id 
=  player_info
[ 'clipId' ]   84                  media_id 
=  self
._ download
_ json
(   85                      'http://feed.theplatform.com/f/h9dtGB/punlNGjMlc1F?fields=id&byContent=byReleases%3DbyId%253D'  +  clip_id
,   86                      clip_id
)[ 'entries' ][ 0 ][ 'id' ]. split ( '/' )[- 1 ]   87              return  self
. url_result ( 'cbcplayer: %s '  %  media_id
,  'CBCPlayer' ,  media_id
)   89              entries 
= [ self
. url_result ( 'cbcplayer: %s '  %  media_id
,  'CBCPlayer' ,  media_id
)  for  media_id 
in  re
. findall ( r
'<iframe[^>]+src="[^"]+?mediaId=(\d+)"' ,  webpage
)]   90              return  self
. playlist_result ( entries
)   93  class  CBCPlayerIE ( InfoExtractor
):   94      _VALID_URL 
=  r
'(?:cbcplayer:|https?://(?:www\.)?cbc\.ca/(?:player/play/|i/caffeine/syndicate/\?mediaId=))(?P<id>\d+)'   96          'url' :  'http://www.cbc.ca/player/play/2683190193' ,   97          'md5' :  '64d25f841ddf4ddb28a235338af32e2c' ,  101              'title' :  'Gerry Runs a Sweat Shop' ,  102              'description' :  'md5:b457e1c01e8ff408d9d801c1c2cd29b0' ,  103              'timestamp' :  1455071400 ,  104              'upload_date' :  '20160210' ,  105              'uploader' :  'CBCC-NEW' ,  108          # Redirected from http://www.cbc.ca/player/AudioMobile/All%20in%20a%20Weekend%20Montreal/ID/2657632011/  109          'url' :  'http://www.cbc.ca/player/play/2657631896' ,  110          'md5' :  'e5e708c34ae6fca156aafe17c43e8b75' ,  114              'title' :  'CBC Montreal is organizing its first ever community hackathon!' ,  115              'description' :  'The modern technology we tend to depend on so heavily, is never without it \' s share of hiccups and headaches. Next weekend - CBC Montreal will be getting members of the public for its first Hackathon.' ,  116              'timestamp' :  1425704400 ,  117              'upload_date' :  '20150307' ,  118              'uploader' :  'CBCC-NEW' ,  121          # available only when we add `formats=MPEG4,FLV,MP3` to theplatform url  122          'url' :  'http://www.cbc.ca/player/play/2164402062' ,  123          'md5' :  '17a61eb813539abea40618d6323a7f82' ,  127              'title' :  'Cancer survivor four times over' ,  128              'description' :  'Tim Mayer has beaten three different forms of cancer four times in five years.' ,  129              'timestamp' :  1320410746 ,  130              'upload_date' :  '20111104' ,  131              'uploader' :  'CBCC-NEW' ,  135      def  _real_extract ( self
,  url
):  136          video_id 
=  self
._ match
_ id
( url
)  138              '_type' :  'url_transparent' ,  139              'ie_key' :  'ThePlatform' ,  141                  'http://link.theplatform.com/s/ExhSPC/media/guid/2655402169/ %s ?mbr=true&formats=MPEG4,FLV,MP3'  %  video_id
, {  142                      'force_smil_url' :  True