mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-10-31 07:50:11 +01:00
[vlive] Improve and style (closes #21209)
This commit is contained in:
parent
01b517a20a
commit
ef19739e64
@ -79,16 +79,12 @@ def is_logged_in():
|
|||||||
'https://www.vlive.tv/auth/loginInfo', None,
|
'https://www.vlive.tv/auth/loginInfo', None,
|
||||||
note='Downloading login info',
|
note='Downloading login info',
|
||||||
headers={'Referer': 'https://www.vlive.tv/home'})
|
headers={'Referer': 'https://www.vlive.tv/home'})
|
||||||
|
return try_get(
|
||||||
return try_get(login_info,
|
login_info, lambda x: x['message']['login'], bool) or False
|
||||||
lambda x: x['message']['login'], bool) or False
|
|
||||||
|
|
||||||
if is_logged_in():
|
|
||||||
return
|
|
||||||
|
|
||||||
LOGIN_URL = 'https://www.vlive.tv/auth/email/login'
|
LOGIN_URL = 'https://www.vlive.tv/auth/email/login'
|
||||||
self._request_webpage(LOGIN_URL, None,
|
self._request_webpage(
|
||||||
note='Downloading login cookies')
|
LOGIN_URL, None, note='Downloading login cookies')
|
||||||
|
|
||||||
self._download_webpage(
|
self._download_webpage(
|
||||||
LOGIN_URL, None, note='Logging in',
|
LOGIN_URL, None, note='Logging in',
|
||||||
@ -144,7 +140,7 @@ def _real_extract(self, url):
|
|||||||
def _get_common_fields(self, webpage):
|
def _get_common_fields(self, webpage):
|
||||||
title = self._og_search_title(webpage)
|
title = self._og_search_title(webpage)
|
||||||
creator = self._html_search_regex(
|
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)
|
webpage, 'creator', fatal=False)
|
||||||
thumbnail = self._og_search_thumbnail(webpage)
|
thumbnail = self._og_search_thumbnail(webpage)
|
||||||
return {
|
return {
|
||||||
@ -183,9 +179,10 @@ def _replay(self, video_id, webpage, long_video_id, key):
|
|||||||
if '' in (long_video_id, key):
|
if '' in (long_video_id, key):
|
||||||
init_page = self._download_init_page(video_id)
|
init_page = self._download_init_page(video_id)
|
||||||
video_info = self._parse_json(self._search_regex(
|
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)
|
video_id)
|
||||||
if video_info['status'] == 'NEED_CHANNEL_PLUS':
|
if video_info.get('status') == 'NEED_CHANNEL_PLUS':
|
||||||
self.raise_login_required(
|
self.raise_login_required(
|
||||||
'This video is only available for CH+ subscribers')
|
'This video is only available for CH+ subscribers')
|
||||||
long_video_id, key = video_info['vid'], video_info['inkey']
|
long_video_id, key = video_info['vid'], video_info['inkey']
|
||||||
|
Loading…
Reference in New Issue
Block a user