projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
66d106f
)
[hotstar] fix extraction in python 2(closes #17696)
author
Remita Amine
<remitamine@gmail.com>
Tue, 2 Oct 2018 05:07:06 +0000
(06:07 +0100)
committer
Remita Amine
<remitamine@gmail.com>
Tue, 2 Oct 2018 05:07:43 +0000
(06:07 +0100)
youtube_dl/extractor/hotstar.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/hotstar.py
b/youtube_dl/extractor/hotstar.py
index 354ac00dcc99c4cfafbc73fc14c43afcc1306aeb..bf5717f1bf1f8366e45222e716951fb11069e8f6 100644
(file)
--- 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,
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)
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']
title = video_data['title']