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.

66 lines
2.8 KiB

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