Merge remote-tracking branch 'jterk/cbs-artists'
[youtube-dl] / youtube_dl / extractor / cbs.py
1 import re
2
3 from .common import InfoExtractor
4
5
6 class CBSIE(InfoExtractor):
7     _VALID_URL = r'https?://(?:www\.)?cbs\.com/shows/[^/]+/(video|artist)/(?P<id>[^/]+)/.*'
8
9     _TESTS = [{
10         u'url': u'http://www.cbs.com/shows/garth-brooks/video/_u7W953k6la293J7EPTd9oHkSPs6Xn6_/connect-chat-feat-garth-brooks/',
11         u'file': u'4JUVEwq3wUT7.flv',
12         u'info_dict': {
13             u'title': u'Connect Chat feat. Garth Brooks',
14             u'description': u'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!',
15             u'duration': 1495,
16         },
17         u'params': {
18             # rtmp download
19             u'skip_download': True,
20         },
21     }, {
22         u'url': u'http://www.cbs.com/shows/liveonletterman/artist/221752/st-vincent/',
23         u'file': u'P9gjWjelt6iP.flv',
24         u'info_dict': {
25             u'title': u'Live on Letterman - St. Vincent',
26             u'description': u'Live On Letterman: St. Vincent in concert from New York\'s Ed Sullivan Theater on Tuesday, July 16, 2014.',
27             u'duration': 3221,
28         },
29         u'params': {
30             # rtmp download
31             u'skip_download': True,
32         },
33     }]
34
35     def _real_extract(self, url):
36         mobj = re.match(self._VALID_URL, url)
37         video_id = mobj.group('id')
38         webpage = self._download_webpage(url, video_id)
39         real_id = self._search_regex(
40             r"video\.settings\.pid\s*=\s*'([^']+)';",
41             webpage, u'real video ID')
42         return self.url_result(u'theplatform:%s' % real_id)