aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-09-05 04:41:02 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-09-05 06:32:10 +0530
commit826446bd82b0168bc40c3be027b2bfa47313ce19 (patch)
treebe004282337b1abbe237ee00b0ee9c50f08edda7
parentbc794913683d98b3ce7f98f19c28e22cb05cd2b5 (diff)
downloadhypervideo-pre-826446bd82b0168bc40c3be027b2bfa47313ce19.tar.lz
hypervideo-pre-826446bd82b0168bc40c3be027b2bfa47313ce19.tar.xz
hypervideo-pre-826446bd82b0168bc40c3be027b2bfa47313ce19.zip
[plutotv] Fix extractor for URLs with `/en`
Closes #431
-rw-r--r--yt_dlp/extractor/plutotv.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/yt_dlp/extractor/plutotv.py b/yt_dlp/extractor/plutotv.py
index b19ff8d02..0cf82466a 100644
--- a/yt_dlp/extractor/plutotv.py
+++ b/yt_dlp/extractor/plutotv.py
@@ -19,7 +19,16 @@ from ..utils import (
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_QUERY_PARAMS = {
'appName': 'web',
@@ -146,17 +155,13 @@ class PlutoTVIE(InfoExtractor):
return info
def _real_extract(self, url):
- path = compat_urlparse.urlparse(url).path
- path_components = path.split('/')
- video_type = path_components[2]
- info_slug = path_components[3]
- video_json = self._download_json(self._INFO_URL + info_slug, info_slug,
- query=self._INFO_QUERY_PARAMS)
+ mobj = self._match_valid_url(url).groupdict()
+ info_slug = mobj['series_or_movie_slug']
+ 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)
- season_number = int_or_none(try_get(path_components, lambda x: x[5]))
- episode_slug = try_get(path_components, lambda x: x[7])
+ season_number, episode_slug = mobj.get('season_number'), mobj.get('episode_slug')
videos = []
for season in video_json['seasons']: