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.

58 lines
2.3 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. class CBSIE(InfoExtractor):
  4. _VALID_URL = r'https?://(?:www\.)?(?:cbs\.com/shows/[^/]+/(?:video|artist)|colbertlateshow\.com/(?:video|podcasts))/[^/]+/(?P<id>[^/]+)'
  5. _TESTS = [{
  6. 'url': 'http://www.cbs.com/shows/garth-brooks/video/_u7W953k6la293J7EPTd9oHkSPs6Xn6_/connect-chat-feat-garth-brooks/',
  7. 'info_dict': {
  8. 'id': '4JUVEwq3wUT7',
  9. 'display_id': 'connect-chat-feat-garth-brooks',
  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. 'display_id': 'st-vincent',
  25. 'ext': 'flv',
  26. 'title': 'Live on Letterman - St. Vincent',
  27. 'description': 'Live On Letterman: St. Vincent in concert from New York\'s Ed Sullivan Theater on Tuesday, July 16, 2014.',
  28. 'duration': 3221,
  29. },
  30. 'params': {
  31. # rtmp download
  32. 'skip_download': True,
  33. },
  34. '_skip': 'Blocked outside the US',
  35. }, {
  36. 'url': 'http://colbertlateshow.com/video/8GmB0oY0McANFvp2aEffk9jZZZ2YyXxy/the-colbeard/',
  37. 'only_matching': True,
  38. }, {
  39. 'url': 'http://www.colbertlateshow.com/podcasts/dYSwjqPs_X1tvbV_P2FcPWRa_qT6akTC/in-the-bad-room-with-stephen/',
  40. 'only_matching': True,
  41. }]
  42. def _real_extract(self, url):
  43. display_id = self._match_id(url)
  44. webpage = self._download_webpage(url, display_id)
  45. real_id = self._search_regex(
  46. [r"video\.settings\.pid\s*=\s*'([^']+)';", r"cbsplayer\.pid\s*=\s*'([^']+)';"],
  47. webpage, 'real video ID')
  48. return {
  49. '_type': 'url_transparent',
  50. 'ie_key': 'ThePlatform',
  51. 'url': 'theplatform:%s' % real_id,
  52. 'display_id': display_id,
  53. }