cbs.py 1.6 KB

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