aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorexwm <thighsman@protonmail.com>2020-11-02 18:34:54 -0500
committerexwm <thighsman@protonmail.com>2020-11-02 18:35:45 -0500
commit130599af9476284e7f0b3be4f68a0ff8346fb6ea (patch)
tree76893a053a3c69a514f277c3f95fe19552c00f19
parent73cc1b9125b5f2f80d777f746c16b5e73b92ddd5 (diff)
downloadhypervideo-pre-130599af9476284e7f0b3be4f68a0ff8346fb6ea.tar.lz
hypervideo-pre-130599af9476284e7f0b3be4f68a0ff8346fb6ea.tar.xz
hypervideo-pre-130599af9476284e7f0b3be4f68a0ff8346fb6ea.zip
[vlive] fix: raise login required error on vlive+
-rw-r--r--youtube_dlc/extractor/vlive.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/youtube_dlc/extractor/vlive.py b/youtube_dlc/extractor/vlive.py
index 874f5203e..38d78eda1 100644
--- a/youtube_dlc/extractor/vlive.py
+++ b/youtube_dlc/extractor/vlive.py
@@ -120,8 +120,15 @@ class VLiveIE(NaverBaseIE):
params = self._parse_json(params, working_id, fatal=False)
video_params = try_get(params, lambda x: x["postDetail"]["post"]["officialVideo"])
+
if video_params is None:
- if 'post' in url:
+ error_data = try_get(params, lambda x: x["postDetail"]["error"]["data"])
+ product_type = try_get(error_data,
+ [lambda x: x["officialVideo"]["productType"],
+ lambda x: x["board"]["boardType"]])
+ if product_type in ('VLIVE_PLUS', 'VLIVE+'):
+ self.raise_login_required('This video is only available for VLIVE+ subscribers')
+ elif 'post' in url:
raise ExtractorError('Url does not appear to be a video post.')
else:
raise ExtractorError('Failed to extract video parameters.')
@@ -191,17 +198,6 @@ class VLiveIE(NaverBaseIE):
key = key_json["inkey"]
long_video_id = video_params["vodId"]
- if '' in (long_video_id, key):
- init_page = self._download_init_page(video_id)
- video_info = self._parse_json(self._search_regex(
- (r'(?s)oVideoStatus\s*=\s*({.+?})\s*</script',
- r'(?s)oVideoStatus\s*=\s*({.+})'), init_page, 'video info'),
- video_id)
- if video_info.get('status') == 'NEED_CHANNEL_PLUS':
- self.raise_login_required(
- 'This video is only available for CH+ subscribers')
- long_video_id, key = video_info['vid'], video_info['inkey']
-
return merge_dicts(
self._get_common_fields(webpage, params),
self._extract_video_info(video_id, long_video_id, key))