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.

49 lines
1.9 KiB

  1. from __future__ import unicode_literals
  2. from .mtv import MTVIE
  3. from ..utils import ExtractorError
  4. class CMTIE(MTVIE):
  5. IE_NAME = 'cmt.com'
  6. _VALID_URL = r'https?://(?:www\.)?cmt\.com/(?:videos|shows)/(?:[^/]+/)*(?P<videoid>\d+)'
  7. _FEED_URL = 'http://www.cmt.com/sitewide/apps/player/embed/rss/'
  8. _TESTS = [{
  9. 'url': 'http://www.cmt.com/videos/garth-brooks/989124/the-call-featuring-trisha-yearwood.jhtml#artist=30061',
  10. 'md5': 'e6b7ef3c4c45bbfae88061799bbba6c2',
  11. 'info_dict': {
  12. 'id': '989124',
  13. 'ext': 'mp4',
  14. 'title': 'Garth Brooks - "The Call (featuring Trisha Yearwood)"',
  15. 'description': 'Blame It All On My Roots',
  16. },
  17. 'skip': 'Video not available',
  18. }, {
  19. 'url': 'http://www.cmt.com/videos/misc/1504699/still-the-king-ep-109-in-3-minutes.jhtml#id=1739908',
  20. 'md5': 'e61a801ca4a183a466c08bd98dccbb1c',
  21. 'info_dict': {
  22. 'id': '1504699',
  23. 'ext': 'mp4',
  24. 'title': 'Still The King Ep. 109 in 3 Minutes',
  25. 'description': 'Relive or catch up with Still The King by watching this recap of season 1, episode 9.',
  26. 'timestamp': 1469421000.0,
  27. 'upload_date': '20160725',
  28. },
  29. }, {
  30. 'url': 'http://www.cmt.com/shows/party-down-south/party-down-south-ep-407-gone-girl/1738172/playlist/#id=1738172',
  31. 'only_matching': True,
  32. }]
  33. @classmethod
  34. def _transform_rtmp_url(cls, rtmp_video_url):
  35. if 'error_not_available.swf' in rtmp_video_url:
  36. raise ExtractorError(
  37. '%s said: video is not available' % cls.IE_NAME, expected=True)
  38. return super(CMTIE, cls)._transform_rtmp_url(rtmp_video_url)
  39. def _extract_mgid(self, webpage):
  40. return self._search_regex(
  41. r'MTVN\.VIDEO\.contentUri\s*=\s*([\'"])(?P<mgid>.+?)\1',
  42. webpage, 'mgid', group='mgid')