aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsepro <sepro@sepr0.com>2025-03-03 22:55:03 +0100
committerGitHub <noreply@github.com>2025-03-03 22:55:03 +0100
commit172d5fcd778bf2605db7647ebc56b29ed18d24ac (patch)
treec543bdb4d024882fb5e8e356fa74163dabebc912
parent7d18fed8f1983fe6de4ddc810dfb2761ba5744ac (diff)
[ie/MagellanTV] Fix extractor (#12505)
Closes #12498 Authored by: seproDev
-rw-r--r--yt_dlp/extractor/magellantv.py46
1 files changed, 28 insertions, 18 deletions
diff --git a/yt_dlp/extractor/magellantv.py b/yt_dlp/extractor/magellantv.py
index 6f2524ba2..e7ae709cf 100644
--- a/yt_dlp/extractor/magellantv.py
+++ b/yt_dlp/extractor/magellantv.py
@@ -1,35 +1,36 @@
from .common import InfoExtractor
-from ..utils import parse_age_limit, parse_duration, traverse_obj
+from ..utils import parse_age_limit, parse_duration, url_or_none
+from ..utils.traversal import traverse_obj
class MagellanTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?magellantv\.com/(?:watch|video)/(?P<id>[\w-]+)'
_TESTS = [{
- 'url': 'https://www.magellantv.com/watch/my-dads-on-death-row?type=v',
+ 'url': 'https://www.magellantv.com/watch/incas-the-new-story?type=v',
'info_dict': {
- 'id': 'my-dads-on-death-row',
+ 'id': 'incas-the-new-story',
'ext': 'mp4',
- 'title': 'My Dad\'s On Death Row',
- 'description': 'md5:33ba23b9f0651fc4537ed19b1d5b0d7a',
- 'duration': 3780.0,
+ 'title': 'Incas: The New Story',
+ 'description': 'md5:936c7f6d711c02dfb9db22a067b586fe',
'age_limit': 14,
- 'tags': ['Justice', 'Reality', 'United States', 'True Crime'],
+ 'duration': 3060.0,
+ 'tags': ['Ancient History', 'Archaeology', 'Anthropology'],
},
'params': {'skip_download': 'm3u8'},
}, {
- 'url': 'https://www.magellantv.com/video/james-bulger-the-new-revelations',
+ 'url': 'https://www.magellantv.com/video/tortured-to-death-murdering-the-nanny',
'info_dict': {
- 'id': 'james-bulger-the-new-revelations',
+ 'id': 'tortured-to-death-murdering-the-nanny',
'ext': 'mp4',
- 'title': 'James Bulger: The New Revelations',
- 'description': 'md5:7b97922038bad1d0fe8d0470d8a189f2',
+ 'title': 'Tortured to Death: Murdering the Nanny',
+ 'description': 'md5:d87033594fa218af2b1a8b49f52511e5',
+ 'age_limit': 14,
'duration': 2640.0,
- 'age_limit': 0,
- 'tags': ['Investigation', 'True Crime', 'Justice', 'Europe'],
+ 'tags': ['True Crime', 'Murder'],
},
'params': {'skip_download': 'm3u8'},
}, {
- 'url': 'https://www.magellantv.com/watch/celebration-nation',
+ 'url': 'https://www.magellantv.com/watch/celebration-nation?type=s',
'info_dict': {
'id': 'celebration-nation',
'ext': 'mp4',
@@ -43,10 +44,19 @@ class MagellanTVIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
- data = traverse_obj(self._search_nextjs_data(webpage, video_id), (
- 'props', 'pageProps', 'reactContext',
- (('video', 'detail'), ('series', 'currentEpisode')), {dict}), get_all=False)
- formats, subtitles = self._extract_m3u8_formats_and_subtitles(data['jwpVideoUrl'], video_id)
+ context = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['reactContext']
+ data = traverse_obj(context, ((('video', 'detail'), ('series', 'currentEpisode')), {dict}, any))
+
+ formats, subtitles = [], {}
+ for m3u8_url in set(traverse_obj(data, ((('manifests', ..., 'hls'), 'jwp_video_url'), {url_or_none}))):
+ fmts, subs = self._extract_m3u8_formats_and_subtitles(
+ m3u8_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
+ formats.extend(fmts)
+ self._merge_subtitles(subs, target=subtitles)
+ if not formats and (error := traverse_obj(context, ('errorDetailPage', 'errorMessage', {str}))):
+ if 'available in your country' in error:
+ self.raise_geo_restricted(msg=error)
+ self.raise_no_formats(f'{self.IE_NAME} said: {error}', expected=True)
return {
'id': video_id,