Skip to content

Commit

Permalink
[vlive] fix: missing expected types for try_get
Browse files Browse the repository at this point in the history
  • Loading branch information
exwm committed Nov 4, 2020
1 parent be5d6c2 commit c434e9f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions youtube_dlc/extractor/vlive.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,14 @@ def _real_extract(self, url):
PARAMS_RE, webpage, PARAMS_FIELD, default='', flags=re.DOTALL)
params = self._parse_json(params, working_id, fatal=False)

video_params = try_get(params, lambda x: x["postDetail"]["post"]["officialVideo"])
video_params = try_get(params, lambda x: x["postDetail"]["post"]["officialVideo"], dict)

if video_params is None:
error_data = try_get(params, lambda x: x["postDetail"]["error"]["data"])
error_data = try_get(params, lambda x: x["postDetail"]["error"]["data"], dict)
product_type = try_get(error_data,
[lambda x: x["officialVideo"]["productType"],
lambda x: x["board"]["boardType"]])
lambda x: x["board"]["boardType"]],
compat_str)
if product_type in ('VLIVE_PLUS', 'VLIVE+'):
self.raise_login_required('This video is only available for VLIVE+ subscribers')
elif 'post' in url:
Expand Down Expand Up @@ -173,7 +174,7 @@ def _live(self, video_id, webpage, params):
play_info = self._download_json(LIVE_INFO_ENDPOINT, video_id,
headers={"referer": "https://www.vlive.tv"})

streams = try_get(play_info, lambda x: x["result"]["streamList"]) or []
streams = try_get(play_info, lambda x: x["result"]["streamList"], list) or []

formats = []
for stream in streams:
Expand Down

0 comments on commit c434e9f

Please sign in to comment.