You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.8 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. class CBSIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?cbs\.com/shows/[^/]+/(?:video|artist)/(?P<id>[^/]+)/.*'
  6. _TESTS = [{
  7. 'url': 'http://www.cbs.com/shows/garth-brooks/video/_u7W953k6la293J7EPTd9oHkSPs6Xn6_/connect-chat-feat-garth-brooks/',
  8. 'info_dict': {
  9. 'id': '4JUVEwq3wUT7',
  10. 'ext': 'flv',
  11. 'title': 'Connect Chat feat. Garth Brooks',
  12. '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!',
  13. 'duration': 1495,
  14. },
  15. 'params': {
  16. # rtmp download
  17. 'skip_download': True,
  18. },
  19. '_skip': 'Blocked outside the US',
  20. }, {
  21. 'url': 'http://www.cbs.com/shows/liveonletterman/artist/221752/st-vincent/',
  22. 'info_dict': {
  23. 'id': 'WWF_5KqY3PK1',
  24. 'ext': 'flv',
  25. 'title': 'Live on Letterman - St. Vincent',
  26. 'description': 'Live On Letterman: St. Vincent in concert from New York\'s Ed Sullivan Theater on Tuesday, July 16, 2014.',
  27. 'duration': 3221,
  28. },
  29. 'params': {
  30. # rtmp download
  31. 'skip_download': True,
  32. },
  33. '_skip': 'Blocked outside the US',
  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, 'real video ID')
  42. return self.url_result(u'theplatform:%s' % real_id)