mirror of https://github.com/yt-dlp/yt-dlp.git
[mtvn] update mtv network related extractors
This commit is contained in:
parent
b6e0c7d2e3
commit
cf7cb94287
|
@ -3,6 +3,8 @@ from __future__ import unicode_literals
|
||||||
from .mtv import MTVServicesInfoExtractor
|
from .mtv import MTVServicesInfoExtractor
|
||||||
from ..utils import unified_strdate
|
from ..utils import unified_strdate
|
||||||
|
|
||||||
|
# TODO Remove - Reason: Outdated Site
|
||||||
|
|
||||||
|
|
||||||
class BetIE(MTVServicesInfoExtractor):
|
class BetIE(MTVServicesInfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?bet\.com/(?:[^/]+/)+(?P<id>.+?)\.html'
|
_VALID_URL = r'https?://(?:www\.)?bet\.com/(?:[^/]+/)+(?P<id>.+?)\.html'
|
||||||
|
|
|
@ -2,6 +2,8 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
from .mtv import MTVIE
|
from .mtv import MTVIE
|
||||||
|
|
||||||
|
# TODO Remove - Reason: Outdated Site
|
||||||
|
|
||||||
|
|
||||||
class CMTIE(MTVIE):
|
class CMTIE(MTVIE):
|
||||||
IE_NAME = 'cmt.com'
|
IE_NAME = 'cmt.com'
|
||||||
|
@ -39,7 +41,7 @@ class CMTIE(MTVIE):
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _extract_mgid(self, webpage):
|
def _extract_mgid(self, webpage, url):
|
||||||
mgid = self._search_regex(
|
mgid = self._search_regex(
|
||||||
r'MTVN\.VIDEO\.contentUri\s*=\s*([\'"])(?P<mgid>.+?)\1',
|
r'MTVN\.VIDEO\.contentUri\s*=\s*([\'"])(?P<mgid>.+?)\1',
|
||||||
webpage, 'mgid', group='mgid', default=None)
|
webpage, 'mgid', group='mgid', default=None)
|
||||||
|
@ -50,5 +52,5 @@ class CMTIE(MTVIE):
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
mgid = self._extract_mgid(webpage)
|
mgid = self._extract_mgid(webpage, url)
|
||||||
return self.url_result('http://media.mtvnservices.com/embed/%s' % mgid)
|
return self.url_result('http://media.mtvnservices.com/embed/%s' % mgid)
|
||||||
|
|
|
@ -48,7 +48,7 @@ class ComedyCentralFullEpisodesIE(MTVServicesInfoExtractor):
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
playlist_id = self._match_id(url)
|
playlist_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, playlist_id)
|
webpage = self._download_webpage(url, playlist_id)
|
||||||
mgid = self._extract_triforce_mgid(webpage, data_zone='t2_lc_promo1')
|
mgid = self._extract_mgid(webpage, url, data_zone='t2_lc_promo1')
|
||||||
videos_info = self._get_videos_info(mgid)
|
videos_info = self._get_videos_info(mgid)
|
||||||
return videos_info
|
return videos_info
|
||||||
|
|
||||||
|
|
|
@ -255,8 +255,10 @@ class MTVServicesInfoExtractor(InfoExtractor):
|
||||||
|
|
||||||
return try_get(feed, lambda x: x['result']['data']['id'], compat_str)
|
return try_get(feed, lambda x: x['result']['data']['id'], compat_str)
|
||||||
|
|
||||||
def _extract_new_triforce_mgid(self, webpage, url='', data_zone=None, video_id=None):
|
def _extract_new_triforce_mgid(self, webpage, url='', video_id=None):
|
||||||
# print(compat_urlparse.urlparse(url).netloc)
|
# print(compat_urlparse.urlparse(url).netloc)
|
||||||
|
if url == '':
|
||||||
|
return
|
||||||
domain = get_domain(url)
|
domain = get_domain(url)
|
||||||
if domain is None:
|
if domain is None:
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
|
@ -268,6 +270,7 @@ class MTVServicesInfoExtractor(InfoExtractor):
|
||||||
triforce_manifest_url = _TRIFORCE_V8_TEMPLATE % (domain, enc_url)
|
triforce_manifest_url = _TRIFORCE_V8_TEMPLATE % (domain, enc_url)
|
||||||
|
|
||||||
manifest = self._download_json(triforce_manifest_url, video_id, fatal=False)
|
manifest = self._download_json(triforce_manifest_url, video_id, fatal=False)
|
||||||
|
if manifest:
|
||||||
if manifest.get('manifest').get('type') == 'redirect':
|
if manifest.get('manifest').get('type') == 'redirect':
|
||||||
self.to_screen('Found a redirect. Downloading manifest from new location')
|
self.to_screen('Found a redirect. Downloading manifest from new location')
|
||||||
new_loc = manifest.get('manifest').get('newLocation')
|
new_loc = manifest.get('manifest').get('newLocation')
|
||||||
|
@ -287,7 +290,7 @@ class MTVServicesInfoExtractor(InfoExtractor):
|
||||||
|
|
||||||
return mgid
|
return mgid
|
||||||
|
|
||||||
def _extract_mgid(self, webpage, url):
|
def _extract_mgid(self, webpage, url, data_zone=None):
|
||||||
try:
|
try:
|
||||||
# the url can be http://media.mtvnservices.com/fb/{mgid}.swf
|
# the url can be http://media.mtvnservices.com/fb/{mgid}.swf
|
||||||
# or http://media.mtvnservices.com/{mgid}
|
# or http://media.mtvnservices.com/{mgid}
|
||||||
|
@ -313,7 +316,7 @@ class MTVServicesInfoExtractor(InfoExtractor):
|
||||||
mgid = self._extract_new_triforce_mgid(webpage, url)
|
mgid = self._extract_new_triforce_mgid(webpage, url)
|
||||||
|
|
||||||
if not mgid:
|
if not mgid:
|
||||||
mgid = self._extract_triforce_mgid(webpage)
|
mgid = self._extract_triforce_mgid(webpage, data_zone)
|
||||||
|
|
||||||
return mgid
|
return mgid
|
||||||
|
|
||||||
|
|
|
@ -245,5 +245,5 @@ class NickRuIE(MTVServicesInfoExtractor):
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
mgid = self._extract_mgid(webpage)
|
mgid = self._extract_mgid(webpage, url)
|
||||||
return self.url_result('http://media.mtvnservices.com/embed/%s' % mgid)
|
return self.url_result('http://media.mtvnservices.com/embed/%s' % mgid)
|
||||||
|
|
|
@ -20,8 +20,18 @@ class BellatorIE(MTVServicesInfoExtractor):
|
||||||
_FEED_URL = 'http://www.bellator.com/feeds/mrss/'
|
_FEED_URL = 'http://www.bellator.com/feeds/mrss/'
|
||||||
_GEO_COUNTRIES = ['US']
|
_GEO_COUNTRIES = ['US']
|
||||||
|
|
||||||
def _extract_mgid(self, webpage):
|
def _extract_mgid(self, webpage, url):
|
||||||
return self._extract_triforce_mgid(webpage)
|
mgid = None
|
||||||
|
|
||||||
|
if not mgid:
|
||||||
|
mgid = self._extract_triforce_mgid(webpage)
|
||||||
|
|
||||||
|
if not mgid:
|
||||||
|
mgid = self._extract_new_triforce_mgid(webpage, url)
|
||||||
|
|
||||||
|
return mgid
|
||||||
|
|
||||||
|
# TODO Remove - Reason: Outdated Site
|
||||||
|
|
||||||
|
|
||||||
class ParamountNetworkIE(MTVServicesInfoExtractor):
|
class ParamountNetworkIE(MTVServicesInfoExtractor):
|
||||||
|
@ -43,7 +53,7 @@ class ParamountNetworkIE(MTVServicesInfoExtractor):
|
||||||
_FEED_URL = 'http://www.paramountnetwork.com/feeds/mrss/'
|
_FEED_URL = 'http://www.paramountnetwork.com/feeds/mrss/'
|
||||||
_GEO_COUNTRIES = ['US']
|
_GEO_COUNTRIES = ['US']
|
||||||
|
|
||||||
def _extract_mgid(self, webpage):
|
def _extract_mgid(self, webpage, url):
|
||||||
root_data = self._parse_json(self._search_regex(
|
root_data = self._parse_json(self._search_regex(
|
||||||
r'window\.__DATA__\s*=\s*({.+})',
|
r'window\.__DATA__\s*=\s*({.+})',
|
||||||
webpage, 'data'), None)
|
webpage, 'data'), None)
|
||||||
|
|
|
@ -3,6 +3,8 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
from .mtv import MTVServicesInfoExtractor
|
from .mtv import MTVServicesInfoExtractor
|
||||||
|
|
||||||
|
# TODO Remove - Reason: Outdated Site
|
||||||
|
|
||||||
|
|
||||||
class VH1IE(MTVServicesInfoExtractor):
|
class VH1IE(MTVServicesInfoExtractor):
|
||||||
IE_NAME = 'vh1.com'
|
IE_NAME = 'vh1.com'
|
||||||
|
|
Loading…
Reference in New Issue