aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRemita Amine <[email protected]>2021-04-08 18:53:36 +0100
committerRemita Amine <[email protected]>2021-04-08 18:54:44 +0100
commit27e5a4464d1d4c418d4937492e18a9d47d30fc50 (patch)
tree2459dfa07f780a09db5198ab9143fc5f570791b1
parent545d6cb9d06a8bf32bcd24463c0fd25e650bb2c7 (diff)
downloadyoutube-dl-27e5a4464d1d4c418d4937492e18a9d47d30fc50.tar.gz
youtube-dl-27e5a4464d1d4c418d4937492e18a9d47d30fc50.zip
[mtv] Fix Viacom A/B Testing Video Player extraction(closes #28703)
-rw-r--r--youtube_dl/extractor/mtv.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/youtube_dl/extractor/mtv.py b/youtube_dl/extractor/mtv.py
index 600cf2d89..5a5205c0e 100644
--- a/youtube_dl/extractor/mtv.py
+++ b/youtube_dl/extractor/mtv.py
@@ -255,7 +255,9 @@ class MTVServicesInfoExtractor(InfoExtractor):
@staticmethod
def _extract_child_with_type(parent, t):
- return next(c for c in parent['children'] if c.get('type') == t)
+ for c in parent['children']:
+ if c.get('type') == t:
+ return c
def _extract_mgid(self, webpage):
try:
@@ -286,7 +288,8 @@ class MTVServicesInfoExtractor(InfoExtractor):
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')
+ ab_testing = self._extract_child_with_type(main_container, 'ABTesting')
+ video_player = self._extract_child_with_type(ab_testing or main_container, 'VideoPlayer')
mgid = video_player['props']['media']['video']['config']['uri']
return mgid