cmt.py 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. from .mtv import MTVIE
  2. # TODO: Remove - Reason: Outdated Site
  3. class CMTIE(MTVIE): # XXX: Do not subclass from concrete IE
  4. _WORKING = False
  5. IE_NAME = 'cmt.com'
  6. _VALID_URL = r'https?://(?:www\.)?cmt\.com/(?:videos|shows|(?:full-)?episodes|video-clips)/(?P<id>[^/]+)'
  7. _TESTS = [{
  8. 'url': 'http://www.cmt.com/videos/garth-brooks/989124/the-call-featuring-trisha-yearwood.jhtml#artist=30061',
  9. 'md5': 'e6b7ef3c4c45bbfae88061799bbba6c2',
  10. 'info_dict': {
  11. 'id': '989124',
  12. 'ext': 'mp4',
  13. 'title': 'Garth Brooks - "The Call (featuring Trisha Yearwood)"',
  14. 'description': 'Blame It All On My Roots',
  15. },
  16. 'skip': 'Video not available',
  17. }, {
  18. 'url': 'http://www.cmt.com/videos/misc/1504699/still-the-king-ep-109-in-3-minutes.jhtml#id=1739908',
  19. 'md5': 'e61a801ca4a183a466c08bd98dccbb1c',
  20. 'info_dict': {
  21. 'id': '1504699',
  22. 'ext': 'mp4',
  23. 'title': 'Still The King Ep. 109 in 3 Minutes',
  24. 'description': 'Relive or catch up with Still The King by watching this recap of season 1, episode 9.',
  25. 'timestamp': 1469421000.0,
  26. 'upload_date': '20160725',
  27. },
  28. }, {
  29. 'url': 'http://www.cmt.com/shows/party-down-south/party-down-south-ep-407-gone-girl/1738172/playlist/#id=1738172',
  30. 'only_matching': True,
  31. }, {
  32. 'url': 'http://www.cmt.com/full-episodes/537qb3/nashville-the-wayfaring-stranger-season-5-ep-501',
  33. 'only_matching': True,
  34. }, {
  35. 'url': 'http://www.cmt.com/video-clips/t9e4ci/nashville-juliette-in-2-minutes',
  36. 'only_matching': True,
  37. }]
  38. def _extract_mgid(self, webpage, url):
  39. mgid = self._search_regex(
  40. r'MTVN\.VIDEO\.contentUri\s*=\s*([\'"])(?P<mgid>.+?)\1',
  41. webpage, 'mgid', group='mgid', default=None)
  42. if not mgid:
  43. mgid = self._extract_triforce_mgid(webpage)
  44. return mgid
  45. def _real_extract(self, url):
  46. video_id = self._match_id(url)
  47. webpage = self._download_webpage(url, video_id)
  48. mgid = self._extract_mgid(webpage, url)
  49. return self.url_result(f'http://media.mtvnservices.com/embed/{mgid}')