diff options
author | Sergey M․ <dstftw@gmail.com> | 2018-11-30 00:48:15 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2018-11-30 00:48:15 +0700 |
commit | adbbdefc8126a933d9ff0a6e603fb312e4b4cbdc (patch) | |
tree | 5f88ef90d26e042c9ddf5a61cf77d1c88ee2f491 /youtube_dl | |
parent | 053e5b12b2e38b7d343aafbb7dc13fb8e4933015 (diff) |
[hotstar] Add support for alternative app state layout (closes #18320)
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/hotstar.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/youtube_dl/extractor/hotstar.py b/youtube_dl/extractor/hotstar.py index bf5717f1b..45aa5e7ea 100644 --- a/youtube_dl/extractor/hotstar.py +++ b/youtube_dl/extractor/hotstar.py @@ -43,6 +43,7 @@ class HotStarIE(HotStarBaseIE): IE_NAME = 'hotstar' _VALID_URL = r'https?://(?:www\.)?hotstar\.com/(?:.+?[/-])?(?P<id>\d{10})' _TESTS = [{ + # contentData 'url': 'https://www.hotstar.com/can-you-not-spread-rumours/1000076273', 'info_dict': { 'id': '1000076273', @@ -58,6 +59,10 @@ class HotStarIE(HotStarBaseIE): 'skip_download': True, } }, { + # contentDetail + 'url': 'https://www.hotstar.com/movies/radha-gopalam/1000057157', + 'only_matching': True, + }, { 'url': 'http://www.hotstar.com/sports/cricket/rajitha-sizzles-on-debut-with-329/2001477583', 'only_matching': True, }, { @@ -74,8 +79,12 @@ class HotStarIE(HotStarBaseIE): r'<script>window\.APP_STATE\s*=\s*({.+?})</script>', webpage, 'app state'), video_id) video_data = {} + getters = ( + lambda x, k=k: x['initialState']['content%s' % k]['content'] + for k in ('Data', 'Detail') + ) for v in app_state.values(): - content = try_get(v, lambda x: x['initialState']['contentData']['content'], dict) + content = try_get(v, getters, dict) if content and content.get('contentId') == video_id: video_data = content |