]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/cbs.py
Merge remote-tracking branch 'lenaten/8tracks'
[yt-dlp.git] / youtube_dl / extractor / cbs.py
CommitLineData
e42a692f
PH
1from __future__ import unicode_literals
2
fa3ae234
PH
3import re
4
5from .common import InfoExtractor
6
7
8class CBSIE(InfoExtractor):
e42a692f 9 _VALID_URL = r'https?://(?:www\.)?cbs\.com/shows/[^/]+/(?:video|artist)/(?P<id>[^/]+)/.*'
fa3ae234 10
2871d489 11 _TESTS = [{
e42a692f
PH
12 'url': 'http://www.cbs.com/shows/garth-brooks/video/_u7W953k6la293J7EPTd9oHkSPs6Xn6_/connect-chat-feat-garth-brooks/',
13 'info_dict': {
14 'id': '4JUVEwq3wUT7',
15 'ext': 'flv',
16 'title': 'Connect Chat feat. Garth Brooks',
17 'description': 'Connect with country music singer Garth Brooks, as he chats with fans on Wednesday November 27, 2013. Be sure to tune in to Garth Brooks: Live from Las Vegas, Friday November 29, at 9/8c on CBS!',
18 'duration': 1495,
fa3ae234 19 },
e42a692f 20 'params': {
fa3ae234 21 # rtmp download
e42a692f 22 'skip_download': True,
fa3ae234 23 },
e42a692f 24 '_skip': 'Blocked outside the US',
2871d489 25 }, {
e42a692f
PH
26 'url': 'http://www.cbs.com/shows/liveonletterman/artist/221752/st-vincent/',
27 'info_dict': {
10437550 28 'id': 'WWF_5KqY3PK1',
e42a692f
PH
29 'ext': 'flv',
30 'title': 'Live on Letterman - St. Vincent',
31 'description': 'Live On Letterman: St. Vincent in concert from New York\'s Ed Sullivan Theater on Tuesday, July 16, 2014.',
32 'duration': 3221,
2871d489 33 },
e42a692f 34 'params': {
2871d489 35 # rtmp download
e42a692f 36 'skip_download': True,
2871d489 37 },
e42a692f 38 '_skip': 'Blocked outside the US',
2871d489 39 }]
fa3ae234
PH
40
41 def _real_extract(self, url):
42 mobj = re.match(self._VALID_URL, url)
43 video_id = mobj.group('id')
44 webpage = self._download_webpage(url, video_id)
45 real_id = self._search_regex(
46 r"video\.settings\.pid\s*=\s*'([^']+)';",
e42a692f 47 webpage, 'real video ID')
8865bdeb 48 return self.url_result('theplatform:%s' % real_id)