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