cbs.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. 'ext': 'flv',
  10. 'title': 'Connect Chat feat. Garth Brooks',
  11. '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!',
  12. 'duration': 1495,
  13. },
  14. 'params': {
  15. # rtmp download
  16. 'skip_download': True,
  17. },
  18. '_skip': 'Blocked outside the US',
  19. }, {
  20. 'url': 'http://www.cbs.com/shows/liveonletterman/artist/221752/st-vincent/',
  21. 'info_dict': {
  22. 'id': 'WWF_5KqY3PK1',
  23. 'ext': 'flv',
  24. 'title': 'Live on Letterman - St. Vincent',
  25. 'description': 'Live On Letterman: St. Vincent in concert from New York\'s Ed Sullivan Theater on Tuesday, July 16, 2014.',
  26. 'duration': 3221,
  27. },
  28. 'params': {
  29. # rtmp download
  30. 'skip_download': True,
  31. },
  32. '_skip': 'Blocked outside the US',
  33. }, {
  34. 'url': 'http://colbertlateshow.com/video/8GmB0oY0McANFvp2aEffk9jZZZ2YyXxy/the-colbeard/',
  35. 'only_matching': True,
  36. }, {
  37. 'url': 'http://colbertlateshow.com/podcasts/dYSwjqPs_X1tvbV_P2FcPWRa_qT6akTC/in-the-bad-room-with-stephen/',
  38. 'only_matching': True,
  39. }]
  40. def _real_extract(self, url):
  41. video_id = self._match_id(url)
  42. webpage = self._download_webpage(url, video_id)
  43. real_id = self._search_regex(
  44. [r"video\.settings\.pid\s*=\s*'([^']+)';", r"cbsplayer\.pid\s*=\s*'([^']+)';"],
  45. webpage, 'real video ID')
  46. return self.url_result('theplatform:%s' % real_id)