]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cbc.py
2 from __future__
import unicode_literals
6 from . common
import InfoExtractor
7 from .. compat
import compat_str
15 class CBCIE ( InfoExtractor
):
16 _VALID_URL
= r
'https?://(?:www\.)?cbc\.ca/(?!player/)(?:[^/]+/)+(?P<id>[^/?#]+)'
19 'url' : 'http://www.cbc.ca/22minutes/videos/clips-season-23/don-cherry-play-offs' ,
20 'md5' : '97e24d09672fc4cf56256d6faa6c25bc' ,
24 'title' : 'Don Cherry – All-Stars' ,
25 'description' : 'Don Cherry has a bee in his bonnet about AHL player John Scott because that guy’s got heart.' ,
26 'timestamp' : 1454463000 ,
27 'upload_date' : '20160203' ,
28 'uploader' : 'CBCC-NEW' ,
30 'skip' : 'Geo-restricted to Canada' ,
32 # with clipId, feed available via tpfeed.cbc.ca and feed.theplatform.com
33 'url' : 'http://www.cbc.ca/22minutes/videos/22-minutes-update/22-minutes-update-episode-4' ,
34 'md5' : '162adfa070274b144f4fdc3c3b8207db' ,
38 'title' : '22 Minutes Update: What Not To Wear Quebec' ,
39 'description' : "This week's latest Canadian top political story is What Not To Wear Quebec." ,
40 'upload_date' : '20131025' ,
41 'uploader' : 'CBCC-NEW' ,
42 'timestamp' : 1382717907 ,
45 # with clipId, feed only available via tpfeed.cbc.ca
46 'url' : 'http://www.cbc.ca/archives/entry/1978-robin-williams-freestyles-on-90-minutes-live' ,
47 'md5' : '0274a90b51a9b4971fe005c63f592f12' ,
51 'title' : 'Robin Williams freestyles on 90 Minutes Live' ,
52 'description' : 'Wacky American comedian Robin Williams shows off his infamous "freestyle" comedic talents while being interviewed on CBC \' s 90 Minutes Live.' ,
53 'upload_date' : '19780210' ,
54 'uploader' : 'CBCC-NEW' ,
55 'timestamp' : 255977160 ,
59 'url' : 'http://www.cbc.ca/natureofthings/blog/birds-eye-view-from-vancouvers-burrard-street-bridge-how-we-got-the-shot' ,
61 'md5' : '377572d0b49c4ce0c9ad77470e0b96b4' ,
65 'title' : 'An Eagle \' s-Eye View Off Burrard Bridge' ,
66 'description' : 'Hercules the eagle flies from Vancouver \' s Burrard Bridge down to a nearby park with a mini-camera strapped to his back.' ,
67 'upload_date' : '20160201' ,
68 'timestamp' : 1454342820 ,
69 'uploader' : 'CBCC-NEW' ,
72 'md5' : '415a0e3f586113894174dfb31aa5bb1a' ,
76 'title' : 'Fly like an eagle!' ,
77 'description' : 'Eagle equipped with a mini camera flies from the world \' s tallest tower' ,
78 'upload_date' : '20150315' ,
79 'timestamp' : 1426443984 ,
80 'uploader' : 'CBCC-NEW' ,
83 'skip' : 'Geo-restricted to Canada' ,
87 def suitable ( cls
, url
):
88 return False if CBCPlayerIE
. suitable ( url
) else super ( CBCIE
, cls
). suitable ( url
)
90 def _real_extract ( self
, url
):
91 display_id
= self
._ match
_ id
( url
)
92 webpage
= self
._ download
_ webpage
( url
, display_id
)
93 player_init
= self
._ search
_ regex
(
94 r
'CBC\.APP\.Caffeine\.initInstance\(({.+?})\);' , webpage
, 'player init' ,
97 player_info
= self
._ parse
_ json
( player_init
, display_id
, js_to_json
)
98 media_id
= player_info
. get ( 'mediaId' )
100 clip_id
= player_info
[ 'clipId' ]
101 feed
= self
._ download
_ json
(
102 'http://tpfeed.cbc.ca/f/ExhSPC/vms_5akSXx4Ng_Zn?byCustomValue= {:mpsReleases} { %s }' % clip_id
,
103 clip_id
, fatal
= False )
105 media_id
= try_get ( feed
, lambda x
: x
[ 'entries' ][ 0 ][ 'guid' ], compat_str
)
107 media_id
= self
._ download
_ json
(
108 'http://feed.theplatform.com/f/h9dtGB/punlNGjMlc1F?fields=id&byContent=byReleases%3DbyId%253D' + clip_id
,
109 clip_id
)[ 'entries' ][ 0 ][ 'id' ]. split ( '/' )[- 1 ]
110 return self
. url_result ( 'cbcplayer: %s ' % media_id
, 'CBCPlayer' , media_id
)
112 entries
= [ self
. url_result ( 'cbcplayer: %s ' % media_id
, 'CBCPlayer' , media_id
) for media_id
in re
. findall ( r
'<iframe[^>]+src="[^"]+?mediaId=(\d+)"' , webpage
)]
113 return self
. playlist_result ( entries
)
116 class CBCPlayerIE ( InfoExtractor
):
117 _VALID_URL
= r
'(?:cbcplayer:|https?://(?:www\.)?cbc\.ca/(?:player/play/|i/caffeine/syndicate/\?mediaId=))(?P<id>\d+)'
119 'url' : 'http://www.cbc.ca/player/play/2683190193' ,
120 'md5' : '64d25f841ddf4ddb28a235338af32e2c' ,
124 'title' : 'Gerry Runs a Sweat Shop' ,
125 'description' : 'md5:b457e1c01e8ff408d9d801c1c2cd29b0' ,
126 'timestamp' : 1455071400 ,
127 'upload_date' : '20160210' ,
128 'uploader' : 'CBCC-NEW' ,
130 'skip' : 'Geo-restricted to Canada' ,
132 # Redirected from http://www.cbc.ca/player/AudioMobile/All%20in%20a%20Weekend%20Montreal/ID/2657632011/
133 'url' : 'http://www.cbc.ca/player/play/2657631896' ,
134 'md5' : 'e5e708c34ae6fca156aafe17c43e8b75' ,
138 'title' : 'CBC Montreal is organizing its first ever community hackathon!' ,
139 '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.' ,
140 'timestamp' : 1425704400 ,
141 'upload_date' : '20150307' ,
142 'uploader' : 'CBCC-NEW' ,
145 # available only when we add `formats=MPEG4,FLV,MP3` to theplatform url
146 'url' : 'http://www.cbc.ca/player/play/2164402062' ,
147 'md5' : '17a61eb813539abea40618d6323a7f82' ,
151 'title' : 'Cancer survivor four times over' ,
152 'description' : 'Tim Mayer has beaten three different forms of cancer four times in five years.' ,
153 'timestamp' : 1320410746 ,
154 'upload_date' : '20111104' ,
155 'uploader' : 'CBCC-NEW' ,
159 def _real_extract ( self
, url
):
160 video_id
= self
._ match
_ id
( url
)
162 '_type' : 'url_transparent' ,
163 'ie_key' : 'ThePlatform' ,
165 'http://link.theplatform.com/s/ExhSPC/media/guid/2655402169/ %s ?mbr=true&formats=MPEG4,FLV,MP3' % video_id
, {
166 'force_smil_url' : True