summary refs log tree commit diff
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2018-10-02 06:07:06 +0100
committerRemita Amine <remitamine@gmail.com>2018-10-02 06:07:43 +0100
commit05e7c184da85f83b254bc3d138f89b11da802bdb (patch)
treeaadd8bb46bb0c1ed8a70f45d72223392216c0dcc
parent66d106f2705d565675b6a94fb0e7e0bdfe132065 (diff)
downloadyoutube-dl-05e7c184da85f83b254bc3d138f89b11da802bdb.tar.gz
youtube-dl-05e7c184da85f83b254bc3d138f89b11da802bdb.tar.xz
youtube-dl-05e7c184da85f83b254bc3d138f89b11da802bdb.zip
[hotstar] fix extraction in python 2(closes #17696)
-rw-r--r--youtube_dl/extractor/hotstar.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/youtube_dl/extractor/hotstar.py b/youtube_dl/extractor/hotstar.py
index 354ac00dc..bf5717f1b 100644
--- a/youtube_dl/extractor/hotstar.py
+++ b/youtube_dl/extractor/hotstar.py
@@ -11,6 +11,7 @@ from ..utils import (
     determine_ext,
     ExtractorError,
     int_or_none,
+    try_get,
 )
 
 
@@ -72,7 +73,11 @@ class HotStarIE(HotStarBaseIE):
         app_state = self._parse_json(self._search_regex(
             r'<script>window\.APP_STATE\s*=\s*({.+?})</script>',
             webpage, 'app state'), video_id)
-        video_data = list(app_state.values())[0]['initialState']['contentData']['content']
+        video_data = {}
+        for v in app_state.values():
+            content = try_get(v, lambda x: x['initialState']['contentData']['content'], dict)
+            if content and content.get('contentId') == video_id:
+                video_data = content
 
         title = video_data['title']