[cbs] Modernize

Also add threatening skip blocks in there - access is only possible from the US. We may want to find a better geolocation restriction method for tests.
pull/3307/head^2
Philipp Hagemeister 2014-07-22 17:34:34 +02:00
parent 6ec7538bb4
commit e42a692f00
1 changed files with 24 additions and 18 deletions

View File

@ -1,35 +1,41 @@
from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
class CBSIE(InfoExtractor): class CBSIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?cbs\.com/shows/[^/]+/(video|artist)/(?P<id>[^/]+)/.*' _VALID_URL = r'https?://(?:www\.)?cbs\.com/shows/[^/]+/(?:video|artist)/(?P<id>[^/]+)/.*'
_TESTS = [{ _TESTS = [{
u'url': u'http://www.cbs.com/shows/garth-brooks/video/_u7W953k6la293J7EPTd9oHkSPs6Xn6_/connect-chat-feat-garth-brooks/', 'url': 'http://www.cbs.com/shows/garth-brooks/video/_u7W953k6la293J7EPTd9oHkSPs6Xn6_/connect-chat-feat-garth-brooks/',
u'file': u'4JUVEwq3wUT7.flv', 'info_dict': {
u'info_dict': { 'id': '4JUVEwq3wUT7',
u'title': u'Connect Chat feat. Garth Brooks', 'ext': 'flv',
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!', 'title': 'Connect Chat feat. Garth Brooks',
u'duration': 1495, '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!',
'duration': 1495,
}, },
u'params': { 'params': {
# rtmp download # rtmp download
u'skip_download': True, 'skip_download': True,
}, },
'_skip': 'Blocked outside the US',
}, { }, {
u'url': u'http://www.cbs.com/shows/liveonletterman/artist/221752/st-vincent/', 'url': 'http://www.cbs.com/shows/liveonletterman/artist/221752/st-vincent/',
u'file': u'P9gjWjelt6iP.flv', 'info_dict': {
u'info_dict': { 'id': 'P9gjWjelt6iP',
u'title': u'Live on Letterman - St. Vincent', 'ext': 'flv',
u'description': u'Live On Letterman: St. Vincent in concert from New York\'s Ed Sullivan Theater on Tuesday, July 16, 2014.', 'title': 'Live on Letterman - St. Vincent',
u'duration': 3221, 'description': 'Live On Letterman: St. Vincent in concert from New York\'s Ed Sullivan Theater on Tuesday, July 16, 2014.',
'duration': 3221,
}, },
u'params': { 'params': {
# rtmp download # rtmp download
u'skip_download': True, 'skip_download': True,
}, },
'_skip': 'Blocked outside the US',
}] }]
def _real_extract(self, url): def _real_extract(self, url):
@ -38,5 +44,5 @@ class CBSIE(InfoExtractor):
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
real_id = self._search_regex( real_id = self._search_regex(
r"video\.settings\.pid\s*=\s*'([^']+)';", r"video\.settings\.pid\s*=\s*'([^']+)';",
webpage, u'real video ID') webpage, 'real video ID')
return self.url_result(u'theplatform:%s' % real_id) return self.url_result(u'theplatform:%s' % real_id)