aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2020-11-19 11:54:54 +0100
committerRemita Amine <remitamine@gmail.com>2020-11-19 11:57:09 +0100
commit4fe190df705d16c66fc3e7b2d798ff14ebbc9878 (patch)
treee01ff3251ab1d4c005168d7265eb4fbc9d38e51b /youtube_dl/extractor
parent039e715b3020710546b13976042bd18ab6e2df5b (diff)
[mtv] fix mgid extraction(closes #26841)
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/mtv.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/youtube_dl/extractor/mtv.py b/youtube_dl/extractor/mtv.py
index fedd5f46b..df1034fc5 100644
--- a/youtube_dl/extractor/mtv.py
+++ b/youtube_dl/extractor/mtv.py
@@ -349,6 +349,18 @@ class MTVIE(MTVServicesInfoExtractor):
'only_matching': True,
}]
+ @staticmethod
+ def extract_child_with_type(parent, t):
+ children = parent['children']
+ return next(c for c in children if c.get('type') == t)
+
+ def _extract_mgid(self, webpage):
+ data = self._parse_json(self._search_regex(
+ r'__DATA__\s*=\s*({.+?});', webpage, 'data'), None)
+ main_container = self.extract_child_with_type(data, 'MainContainer')
+ video_player = self.extract_child_with_type(main_container, 'VideoPlayer')
+ return video_player['props']['media']['video']['config']['uri']
+
class MTVJapanIE(MTVServicesInfoExtractor):
IE_NAME = 'mtvjapan'