From 2fd514d1b3a7e4351ab8d10cbe5c62a114dce41b Mon Sep 17 00:00:00 2001 From: enigmaquip Date: Mon, 30 Oct 2017 21:55:52 -0600 Subject: [PATCH 1/3] [MTV] add mtvbase extractor --- youtube_dl/extractor/mtv.py | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/youtube_dl/extractor/mtv.py b/youtube_dl/extractor/mtv.py index 1154a3536..4ce5c0365 100644 --- a/youtube_dl/extractor/mtv.py +++ b/youtube_dl/extractor/mtv.py @@ -481,3 +481,53 @@ class MTVDEIE(MTVServicesInfoExtractor): item_id = item.get('id') if item_id and compat_str(item_id) == video_id: return self._get_videos_info_from_url(_mrss_url(item), video_id) + + class MTVBASEIE(MTVServicesInfoExtractor): + IE_NAME = 'mtvbase' + _VALID_URL = r'https?://(?:www\.)?mtvbase\.com/music/videos/(?P[^/?#.]+)' + + _TESTS = [{ + # Vevo Redirect + 'url': 'http://www.mtvbase.com/music/videos/n81o96/Phases', + 'info_dict': { + 'id': 'FIPEB1700040', + 'ext': 'mp4', + 'title': 'French Montana - Phases (Lyric Video)', + 'upload_date': '20170927', + 'uploader': 'French Montana', + 'timestamp': 1506549600, + + }, + 'params': { + # m3u8 download + 'skip_download': True, + } + },{ + # MTV Services Embed Redirect + 'url': 'http://www.mtvbase.com/music/videos/ymjhpx/Self-Made', + 'info_dict': { + 'id': '3866ee82-b015-11e7-9a25-a4badb20dab5', + 'ext': 'mp4', + 'description': 'Self-Made', + 'title': 'Self-Made', + }, + 'params': { + # m3u8 download + 'skip_download': True, + }, + }] + + def _real_extract(self, url): + title = url_basename(url) + webpage = self._download_webpage(url, title) + feed_url = re.search(r'data-tffeed="(.*?)"', webpage).group(1) + feed = self._download_json(feed_url, title, fatal=False) + #check for Vevo + m_vevo = try_get(feed, lambda x: x['result']['settings']['playerOverride']['type'], compat_str) + if m_vevo == 'Vevo': + vevo_id = try_get(feed, lambda x: x['result']['settings']['playerOverride']['id'], compat_str) + if vevo_id: + self.to_screen('Vevo video detected: %s' % vevo_id) + return self.url_result('vevo:%s' % vevo_id, ie='Vevo') + mgid = try_get(feed, lambda x: x['result']['data']['id'], compat_str) + return self.url_result('http://media.mtvnservices.com/embed/%s' % mgid) From fb4cdac84484d8d48c1139c8279d79ae731d8194 Mon Sep 17 00:00:00 2001 From: enigmaquip Date: Mon, 30 Oct 2017 22:02:15 -0600 Subject: [PATCH 2/3] Update extractors.py --- youtube_dl/extractor/extractors.py | 1 + 1 file changed, 1 insertion(+) diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 2eed706f9..63f2d2ac5 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -617,6 +617,7 @@ from .mtv import ( MTVServicesEmbeddedIE, MTVDEIE, MTV81IE, + MTVBASEIE, ) from .muenchentv import MuenchenTVIE from .musicplayon import MusicPlayOnIE From 37af91308ac7bebb467f90c60acce545664f9d9e Mon Sep 17 00:00:00 2001 From: enigmaquip Date: Mon, 30 Oct 2017 22:08:51 -0600 Subject: [PATCH 3/3] Update mtv.py fixed bad spacing --- youtube_dl/extractor/mtv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/mtv.py b/youtube_dl/extractor/mtv.py index 4ce5c0365..46a0b583c 100644 --- a/youtube_dl/extractor/mtv.py +++ b/youtube_dl/extractor/mtv.py @@ -482,7 +482,7 @@ class MTVDEIE(MTVServicesInfoExtractor): if item_id and compat_str(item_id) == video_id: return self._get_videos_info_from_url(_mrss_url(item), video_id) - class MTVBASEIE(MTVServicesInfoExtractor): +class MTVBASEIE(MTVServicesInfoExtractor): IE_NAME = 'mtvbase' _VALID_URL = r'https?://(?:www\.)?mtvbase\.com/music/videos/(?P[^/?#.]+)'