mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-14 04:13:20 +00:00
parent
bc79491368
commit
826446bd82
|
@ -19,7 +19,16 @@
|
||||||
|
|
||||||
|
|
||||||
class PlutoTVIE(InfoExtractor):
|
class PlutoTVIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?pluto\.tv(?:/en)?/on-demand/(?P<video_type>movies|series)/(?P<slug>.*)/?$'
|
_VALID_URL = r'''(?x)
|
||||||
|
https?://(?:www\.)?pluto\.tv(?:/en)?/on-demand
|
||||||
|
/(?P<video_type>movies|series)
|
||||||
|
/(?P<series_or_movie_slug>[^/]+)
|
||||||
|
(?:
|
||||||
|
/seasons?/(?P<season_no>\d+)
|
||||||
|
(?:/episode/(?P<episode_slug>[^/]+))?
|
||||||
|
)?
|
||||||
|
/?(?:$|[#?])'''
|
||||||
|
|
||||||
_INFO_URL = 'https://service-vod.clusters.pluto.tv/v3/vod/slugs/'
|
_INFO_URL = 'https://service-vod.clusters.pluto.tv/v3/vod/slugs/'
|
||||||
_INFO_QUERY_PARAMS = {
|
_INFO_QUERY_PARAMS = {
|
||||||
'appName': 'web',
|
'appName': 'web',
|
||||||
|
@ -146,17 +155,13 @@ def _get_video_info(self, video_json, slug, series_name=None):
|
||||||
return info
|
return info
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
path = compat_urlparse.urlparse(url).path
|
mobj = self._match_valid_url(url).groupdict()
|
||||||
path_components = path.split('/')
|
info_slug = mobj['series_or_movie_slug']
|
||||||
video_type = path_components[2]
|
video_json = self._download_json(self._INFO_URL + info_slug, info_slug, query=self._INFO_QUERY_PARAMS)
|
||||||
info_slug = path_components[3]
|
|
||||||
video_json = self._download_json(self._INFO_URL + info_slug, info_slug,
|
|
||||||
query=self._INFO_QUERY_PARAMS)
|
|
||||||
|
|
||||||
if video_type == 'series':
|
if mobj['video_type'] == 'series':
|
||||||
series_name = video_json.get('name', info_slug)
|
series_name = video_json.get('name', info_slug)
|
||||||
season_number = int_or_none(try_get(path_components, lambda x: x[5]))
|
season_number, episode_slug = mobj.get('season_number'), mobj.get('episode_slug')
|
||||||
episode_slug = try_get(path_components, lambda x: x[7])
|
|
||||||
|
|
||||||
videos = []
|
videos = []
|
||||||
for season in video_json['seasons']:
|
for season in video_json['seasons']:
|
||||||
|
|
Loading…
Reference in a new issue