[cbc] extract http formats and update tests

This commit is contained in:
remitamine 2016-05-20 06:53:14 +01:00
parent f6e588afc0
commit 52f7c75cff

View file

@ -4,7 +4,10 @@
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import js_to_json from ..utils import (
js_to_json,
smuggle_url,
)
class CBCIE(InfoExtractor): class CBCIE(InfoExtractor):
@ -12,57 +15,54 @@ class CBCIE(InfoExtractor):
_TESTS = [{ _TESTS = [{
# with mediaId # with mediaId
'url': 'http://www.cbc.ca/22minutes/videos/clips-season-23/don-cherry-play-offs', 'url': 'http://www.cbc.ca/22minutes/videos/clips-season-23/don-cherry-play-offs',
'md5': '97e24d09672fc4cf56256d6faa6c25bc',
'info_dict': { 'info_dict': {
'id': '2682904050', 'id': '2682904050',
'ext': 'flv', 'ext': 'mp4',
'title': 'Don Cherry All-Stars', 'title': 'Don Cherry All-Stars',
'description': 'Don Cherry has a bee in his bonnet about AHL player John Scott because that guys got heart.', 'description': 'Don Cherry has a bee in his bonnet about AHL player John Scott because that guys got heart.',
'timestamp': 1454475540, 'timestamp': 1454463000,
'upload_date': '20160203', 'upload_date': '20160203',
}, 'uploader': 'CBCC-NEW',
'params': {
# rtmp download
'skip_download': True,
}, },
}, { }, {
# with clipId # with clipId
'url': 'http://www.cbc.ca/archives/entry/1978-robin-williams-freestyles-on-90-minutes-live', 'url': 'http://www.cbc.ca/archives/entry/1978-robin-williams-freestyles-on-90-minutes-live',
'info_dict': { 'info_dict': {
'id': '2487345465', 'id': '2487345465',
'ext': 'flv', 'ext': 'mp4',
'title': 'Robin Williams freestyles on 90 Minutes Live', 'title': 'Robin Williams freestyles on 90 Minutes Live',
'description': 'Wacky American comedian Robin Williams shows off his infamous "freestyle" comedic talents while being interviewed on CBC\'s 90 Minutes Live.', 'description': 'Wacky American comedian Robin Williams shows off his infamous "freestyle" comedic talents while being interviewed on CBC\'s 90 Minutes Live.',
'upload_date': '19700101', 'upload_date': '19780210',
'uploader': 'CBCC-NEW', 'uploader': 'CBCC-NEW',
}, 'timestamp': 255977160,
'params': {
# rtmp download
'skip_download': True,
}, },
}, { }, {
# multiple iframes # multiple iframes
'url': 'http://www.cbc.ca/natureofthings/blog/birds-eye-view-from-vancouvers-burrard-street-bridge-how-we-got-the-shot', 'url': 'http://www.cbc.ca/natureofthings/blog/birds-eye-view-from-vancouvers-burrard-street-bridge-how-we-got-the-shot',
'playlist': [{ 'playlist': [{
'md5': '377572d0b49c4ce0c9ad77470e0b96b4',
'info_dict': { 'info_dict': {
'id': '2680832926', 'id': '2680832926',
'ext': 'flv', 'ext': 'mp4',
'title': 'An Eagle\'s-Eye View Off Burrard Bridge', 'title': 'An Eagle\'s-Eye View Off Burrard Bridge',
'description': 'Hercules the eagle flies from Vancouver\'s Burrard Bridge down to a nearby park with a mini-camera strapped to his back.', 'description': 'Hercules the eagle flies from Vancouver\'s Burrard Bridge down to a nearby park with a mini-camera strapped to his back.',
'upload_date': '19700101', 'upload_date': '20160201',
'timestamp': 1454342820,
'uploader': 'CBCC-NEW',
}, },
}, { }, {
'md5': '415a0e3f586113894174dfb31aa5bb1a',
'info_dict': { 'info_dict': {
'id': '2658915080', 'id': '2658915080',
'ext': 'flv', 'ext': 'mp4',
'title': 'Fly like an eagle!', 'title': 'Fly like an eagle!',
'description': 'Eagle equipped with a mini camera flies from the world\'s tallest tower', 'description': 'Eagle equipped with a mini camera flies from the world\'s tallest tower',
'upload_date': '19700101', 'upload_date': '20150315',
'timestamp': 1426443984,
'uploader': 'CBCC-NEW',
}, },
}], }],
'params': {
# rtmp download
'skip_download': True,
},
}] }]
@classmethod @classmethod
@ -95,20 +95,23 @@ class CBCPlayerIE(InfoExtractor):
'url': 'http://www.cbc.ca/player/play/2683190193', 'url': 'http://www.cbc.ca/player/play/2683190193',
'info_dict': { 'info_dict': {
'id': '2683190193', 'id': '2683190193',
'ext': 'flv', 'ext': 'mp4',
'title': 'Gerry Runs a Sweat Shop', 'title': 'Gerry Runs a Sweat Shop',
'description': 'md5:b457e1c01e8ff408d9d801c1c2cd29b0', 'description': 'md5:b457e1c01e8ff408d9d801c1c2cd29b0',
'timestamp': 1455067800, 'timestamp': 1455071400,
'upload_date': '20160210', 'upload_date': '20160210',
}, 'uploader': 'CBCC-NEW',
'params': {
# rtmp download
'skip_download': True,
}, },
} }
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
return self.url_result( return {
'http://feed.theplatform.com/f/ExhSPC/vms_5akSXx4Ng_Zn?byGuid=%s' % video_id, '_type': 'url_transparent',
'ThePlatformFeed', video_id) 'ie_key': 'ThePlatform',
'url': smuggle_url(
'http://link.theplatform.com/s/ExhSPC/media/guid/2655402169/%s?mbr=true' % video_id, {
'force_smil_url': True
}),
'id': video_id,
}