diff options
author | Sergey M․ <dstftw@gmail.com> | 2019-06-08 02:19:07 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2019-06-08 02:22:23 +0700 |
commit | ef19739e64e91bb5ca2eeccd3ff6fdefb1a98cce (patch) | |
tree | eda7bab928c497f61a49759b07abc16b27accadf /youtube_dl | |
parent | 01b517a20a2645a05b44d3ae65b587fef3fda788 (diff) |
[vlive] Improve and style (closes #21209)
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/vlive.py | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/youtube_dl/extractor/vlive.py b/youtube_dl/extractor/vlive.py index 78436c45c..f75d4e254 100644 --- a/youtube_dl/extractor/vlive.py +++ b/youtube_dl/extractor/vlive.py @@ -79,16 +79,12 @@ class VLiveIE(InfoExtractor): 'https://www.vlive.tv/auth/loginInfo', None, note='Downloading login info', headers={'Referer': 'https://www.vlive.tv/home'}) - - return try_get(login_info, - lambda x: x['message']['login'], bool) or False - - if is_logged_in(): - return + return try_get( + login_info, lambda x: x['message']['login'], bool) or False LOGIN_URL = 'https://www.vlive.tv/auth/email/login' - self._request_webpage(LOGIN_URL, None, - note='Downloading login cookies') + self._request_webpage( + LOGIN_URL, None, note='Downloading login cookies') self._download_webpage( LOGIN_URL, None, note='Logging in', @@ -144,7 +140,7 @@ class VLiveIE(InfoExtractor): def _get_common_fields(self, webpage): title = self._og_search_title(webpage) creator = self._html_search_regex( - r'<div[^>]+class="info_area"[^>]*>\s*(?:<em[^>]*>.*</em\s*>\s*)?<a\s+[^>]*>([^<]+)', + r'<div[^>]+class="info_area"[^>]*>\s*(?:<em[^>]*>.*?</em\s*>\s*)?<a\s+[^>]*>([^<]+)', webpage, 'creator', fatal=False) thumbnail = self._og_search_thumbnail(webpage) return { @@ -183,9 +179,10 @@ class VLiveIE(InfoExtractor): 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*({.*})', init_page, 'video info'), + (r'(?s)oVideoStatus\s*=\s*({.+?})\s*</script', + r'(?s)oVideoStatus\s*=\s*({.+})'), init_page, 'video info'), video_id) - if video_info['status'] == 'NEED_CHANNEL_PLUS': + 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'] |