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',
28 'skip': 'Geo-restricted to Canada',
31 'url': 'http://www.cbc.ca/archives/entry/1978-robin-williams-freestyles-on-90-minutes-live',
32 'md5': '0274a90b51a9b4971fe005c63f592f12',
36 'title': 'Robin Williams freestyles on 90 Minutes Live',
37 'description': 'Wacky American comedian Robin Williams shows off his infamous "freestyle" comedic talents while being interviewed on CBC\'s 90 Minutes Live.',
38 'upload_date': '19780210',
39 'uploader': 'CBCC-NEW',
40 'timestamp': 255977160,
44 'url': 'http://www.cbc.ca/natureofthings/blog/birds-eye-view-from-vancouvers-burrard-street-bridge-how-we-got-the-shot',
46 'md5': '377572d0b49c4ce0c9ad77470e0b96b4',
50 'title': 'An Eagle\'s-Eye View Off Burrard Bridge',
51 'description': 'Hercules the eagle flies from Vancouver\'s Burrard Bridge down to a nearby park with a mini-camera strapped to his back.',
52 'upload_date': '20160201',
53 'timestamp': 1454342820,
54 'uploader': 'CBCC-NEW',
57 'md5': '415a0e3f586113894174dfb31aa5bb1a',
61 'title': 'Fly like an eagle!',
62 'description': 'Eagle equipped with a mini camera flies from the world\'s tallest tower',
63 'upload_date': '20150315',
64 'timestamp': 1426443984,
65 'uploader': 'CBCC-NEW',
68 'skip': 'Geo-restricted to Canada',
72 def suitable(cls, url):
73 return False if CBCPlayerIE.suitable(url) else super(CBCIE, cls).suitable(url)
75 def _real_extract(self, url):
76 display_id = self._match_id(url)
77 webpage = self._download_webpage(url, display_id)
78 player_init = self._search_regex(
79 r'CBC\.APP\.Caffeine\.initInstance\(({.+?})\);', webpage, 'player init',
82 player_info = self._parse_json(player_init, display_id, js_to_json)
83 media_id = player_info.get('mediaId')
85 clip_id = player_info['clipId']
86 media_id = self._download_json(
87 'http://feed.theplatform.com/f/h9dtGB/punlNGjMlc1F?fields=id&byContent=byReleases%3DbyId%253D' + clip_id,
88 clip_id)['entries'][0]['id'].split('/')[-1]
89 return self.url_result('cbcplayer:%s' % media_id, 'CBCPlayer', media_id)
91 entries = [self.url_result('cbcplayer:%s' % media_id, 'CBCPlayer', media_id) for media_id in re.findall(r'<iframe[^>]+src="[^"]+?mediaId=(\d+)"', webpage)]
92 return self.playlist_result(entries)
95 class CBCPlayerIE(InfoExtractor):
96 _VALID_URL = r'(?:cbcplayer:|https?://(?:www\.)?cbc\.ca/(?:player/play/|i/caffeine/syndicate/\?mediaId=))(?P<id>\d+)'
98 'url': 'http://www.cbc.ca/player/play/2683190193',
99 'md5': '64d25f841ddf4ddb28a235338af32e2c',
103 'title': 'Gerry Runs a Sweat Shop',
104 'description': 'md5:b457e1c01e8ff408d9d801c1c2cd29b0',
105 'timestamp': 1455071400,
106 'upload_date': '20160210',
107 'uploader': 'CBCC-NEW',
109 'skip': 'Geo-restricted to Canada',
111 # Redirected from http://www.cbc.ca/player/AudioMobile/All%20in%20a%20Weekend%20Montreal/ID/2657632011/
112 'url': 'http://www.cbc.ca/player/play/2657631896',
113 'md5': 'e5e708c34ae6fca156aafe17c43e8b75',
117 'title': 'CBC Montreal is organizing its first ever community hackathon!',
118 '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.',
119 'timestamp': 1425704400,
120 'upload_date': '20150307',
121 'uploader': 'CBCC-NEW',
124 # available only when we add `formats=MPEG4,FLV,MP3` to theplatform url
125 'url': 'http://www.cbc.ca/player/play/2164402062',
126 'md5': '17a61eb813539abea40618d6323a7f82',
130 'title': 'Cancer survivor four times over',
131 'description': 'Tim Mayer has beaten three different forms of cancer four times in five years.',
132 'timestamp': 1320410746,
133 'upload_date': '20111104',
134 'uploader': 'CBCC-NEW',
138 def _real_extract(self, url):
139 video_id = self._match_id(url)
141 '_type': 'url_transparent',
142 'ie_key': 'ThePlatform',
144 'http://link.theplatform.com/s/ExhSPC/media/guid/2655402169/%s?mbr=true&formats=MPEG4,FLV,MP3' % video_id, {
145 'force_smil_url': True