]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cbssports.py
d/rules: Drop makefile mangling
[youtubedl] / youtube_dl / extractor / cbssports.py
1 from __future__ import unicode_literals
2
3 from .cbs import CBSBaseIE
4
5
6 class CBSSportsIE(CBSBaseIE):
7 _VALID_URL = r'https?://(?:www\.)?cbssports\.com/[^/]+/(?:video|news)/(?P<id>[^/?#&]+)'
8
9 _TESTS = [{
10 'url': 'https://www.cbssports.com/nba/video/donovan-mitchell-flashes-star-potential-in-game-2-victory-over-thunder/',
11 'info_dict': {
12 'id': '1214315075735',
13 'ext': 'mp4',
14 'title': 'Donovan Mitchell flashes star potential in Game 2 victory over Thunder',
15 'description': 'md5:df6f48622612c2d6bd2e295ddef58def',
16 'timestamp': 1524111457,
17 'upload_date': '20180419',
18 'uploader': 'CBSI-NEW',
19 },
20 'params': {
21 # m3u8 download
22 'skip_download': True,
23 }
24 }, {
25 'url': 'https://www.cbssports.com/nba/news/nba-playoffs-2018-watch-76ers-vs-heat-game-3-series-schedule-tv-channel-online-stream/',
26 'only_matching': True,
27 }]
28
29 def _extract_video_info(self, filter_query, video_id):
30 return self._extract_feed_info('dJ5BDC', 'VxxJg8Ymh8sE', filter_query, video_id)
31
32 def _real_extract(self, url):
33 display_id = self._match_id(url)
34 webpage = self._download_webpage(url, display_id)
35 video_id = self._search_regex(
36 [r'(?:=|%26)pcid%3D(\d+)', r'embedVideo(?:Container)?_(\d+)'],
37 webpage, 'video id')
38 return self._extract_video_info('byId=%s' % video_id, video_id)