]>
Commit | Line | Data |
---|---|---|
e42a692f PH |
1 | from __future__ import unicode_literals |
2 | ||
fa3ae234 | 3 | from .common import InfoExtractor |
5c2266df S |
4 | from ..utils import ( |
5 | sanitized_Request, | |
6 | smuggle_url, | |
7 | ) | |
fa3ae234 PH |
8 | |
9 | ||
10 | class CBSIE(InfoExtractor): | |
9d581f3d | 11 | _VALID_URL = r'https?://(?:www\.)?(?:cbs\.com/shows/[^/]+/(?:video|artist)|colbertlateshow\.com/(?:video|podcasts))/[^/]+/(?P<id>[^/]+)' |
fa3ae234 | 12 | |
2871d489 | 13 | _TESTS = [{ |
e42a692f PH |
14 | 'url': 'http://www.cbs.com/shows/garth-brooks/video/_u7W953k6la293J7EPTd9oHkSPs6Xn6_/connect-chat-feat-garth-brooks/', |
15 | 'info_dict': { | |
16 | 'id': '4JUVEwq3wUT7', | |
9d581f3d | 17 | 'display_id': 'connect-chat-feat-garth-brooks', |
e42a692f PH |
18 | 'ext': 'flv', |
19 | 'title': 'Connect Chat feat. Garth Brooks', | |
20 | '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!', | |
21 | 'duration': 1495, | |
fa3ae234 | 22 | }, |
e42a692f | 23 | 'params': { |
fa3ae234 | 24 | # rtmp download |
e42a692f | 25 | 'skip_download': True, |
fa3ae234 | 26 | }, |
e42a692f | 27 | '_skip': 'Blocked outside the US', |
2871d489 | 28 | }, { |
e42a692f PH |
29 | 'url': 'http://www.cbs.com/shows/liveonletterman/artist/221752/st-vincent/', |
30 | 'info_dict': { | |
10437550 | 31 | 'id': 'WWF_5KqY3PK1', |
9d581f3d | 32 | 'display_id': 'st-vincent', |
e42a692f PH |
33 | 'ext': 'flv', |
34 | 'title': 'Live on Letterman - St. Vincent', | |
35 | 'description': 'Live On Letterman: St. Vincent in concert from New York\'s Ed Sullivan Theater on Tuesday, July 16, 2014.', | |
36 | 'duration': 3221, | |
2871d489 | 37 | }, |
e42a692f | 38 | 'params': { |
2871d489 | 39 | # rtmp download |
e42a692f | 40 | 'skip_download': True, |
2871d489 | 41 | }, |
e42a692f | 42 | '_skip': 'Blocked outside the US', |
9bf99891 S |
43 | }, { |
44 | 'url': 'http://colbertlateshow.com/video/8GmB0oY0McANFvp2aEffk9jZZZ2YyXxy/the-colbeard/', | |
45 | 'only_matching': True, | |
46 | }, { | |
9d581f3d | 47 | 'url': 'http://www.colbertlateshow.com/podcasts/dYSwjqPs_X1tvbV_P2FcPWRa_qT6akTC/in-the-bad-room-with-stephen/', |
9bf99891 | 48 | 'only_matching': True, |
2871d489 | 49 | }] |
fa3ae234 PH |
50 | |
51 | def _real_extract(self, url): | |
9d581f3d | 52 | display_id = self._match_id(url) |
5c2266df | 53 | request = sanitized_Request(url) |
4e21b3a9 S |
54 | # Android UA is served with higher quality (720p) streams (see |
55 | # https://github.com/rg3/youtube-dl/issues/7490) | |
56 | request.add_header('User-Agent', 'Mozilla/5.0 (Linux; Android 4.4; Nexus 5)') | |
57 | webpage = self._download_webpage(request, display_id) | |
fa3ae234 | 58 | real_id = self._search_regex( |
9bf99891 | 59 | [r"video\.settings\.pid\s*=\s*'([^']+)';", r"cbsplayer\.pid\s*=\s*'([^']+)';"], |
e42a692f | 60 | webpage, 'real video ID') |
9d581f3d S |
61 | return { |
62 | '_type': 'url_transparent', | |
63 | 'ie_key': 'ThePlatform', | |
4e21b3a9 S |
64 | 'url': smuggle_url( |
65 | 'http://link.theplatform.com/s/dJ5BDC/%s?mbr=true&manifest=m3u' % real_id, | |
66 | {'force_smil_url': True}), | |
9d581f3d S |
67 | 'display_id': display_id, |
68 | } |