]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cbs.py
e43756ec69b1d7f1872e45cc6901b41752ec6ef6
[youtubedl] / youtube_dl / extractor / cbs.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6
7
8 class CBSIE(InfoExtractor):
9 _VALID_URL = r'https?://(?:www\.)?cbs\.com/shows/[^/]+/(?:video|artist)/(?P<id>[^/]+)/.*'
10
11 _TESTS = [{
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,
19 },
20 'params': {
21 # rtmp download
22 'skip_download': True,
23 },
24 '_skip': 'Blocked outside the US',
25 }, {
26 'url': 'http://www.cbs.com/shows/liveonletterman/artist/221752/st-vincent/',
27 'info_dict': {
28 'id': 'WWF_5KqY3PK1',
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,
33 },
34 'params': {
35 # rtmp download
36 'skip_download': True,
37 },
38 '_skip': 'Blocked outside the US',
39 }]
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*'([^']+)';",
47 webpage, 'real video ID')
48 return self.url_result('theplatform:%s' % real_id)