mirror of
https://github.com/ihmily/DouyinLiveRecorder.git
synced 2025-12-26 05:48:32 +08:00
fix: add twitcasting tv login setting
This commit is contained in:
parent
3d26bed37f
commit
2df8864b86
18
spider.py
18
spider.py
@ -1590,12 +1590,12 @@ def login_twitcasting(
|
|||||||
if cookies:
|
if cookies:
|
||||||
headers['Cookie'] = cookies
|
headers['Cookie'] = cookies
|
||||||
|
|
||||||
if account_type == "normal":
|
if account_type == "twitter":
|
||||||
login_url = 'https://twitcasting.tv/indexcaslogin.php?redir=%2F&keep=1'
|
|
||||||
login_api = 'https://twitcasting.tv/indexcaslogin.php?redir=/indexloginwindow.php?next=%2F&keep=1'
|
|
||||||
else:
|
|
||||||
login_url = 'https://twitcasting.tv/indexpasswordlogin.php'
|
login_url = 'https://twitcasting.tv/indexpasswordlogin.php'
|
||||||
login_api = 'https://twitcasting.tv/indexpasswordlogin.php?redir=/indexloginwindow.php?next=%2F&keep=1'
|
login_api = 'https://twitcasting.tv/indexpasswordlogin.php?redir=/indexloginwindow.php?next=%2F&keep=1'
|
||||||
|
else:
|
||||||
|
login_url = 'https://twitcasting.tv/indexcaslogin.php?redir=%2F&keep=1'
|
||||||
|
login_api = 'https://twitcasting.tv/indexcaslogin.php?redir=/indexloginwindow.php?next=%2F&keep=1'
|
||||||
|
|
||||||
html_str = get_req(login_url, proxy_addr=proxy_addr, headers=headers)
|
html_str = get_req(login_url, proxy_addr=proxy_addr, headers=headers)
|
||||||
cs_session_id = re.search('<input type="hidden" name="cs_session_id" value="(.*?)">', html_str).group(1)
|
cs_session_id = re.search('<input type="hidden" name="cs_session_id" value="(.*?)">', html_str).group(1)
|
||||||
@ -1661,6 +1661,16 @@ def get_twitcasting_stream_url(
|
|||||||
result = {"anchor_name": '', "is_live": False}
|
result = {"anchor_name": '', "is_live": False}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
to_login = get_params(url, "login")
|
||||||
|
if to_login == 'true':
|
||||||
|
print('TwitCasting正在尝试登录...')
|
||||||
|
new_cookie = login_twitcasting(account_type=account_type, username=username, password=password,
|
||||||
|
proxy_addr=proxy_addr, cookies=cookies)
|
||||||
|
if not new_cookie:
|
||||||
|
raise RuntimeError('TwitCasting登录失败,请检查配置文件中的账号密码是否正确')
|
||||||
|
print('TwitCasting 登录成功!开始获取数据...')
|
||||||
|
headers['Cookie'] = new_cookie
|
||||||
|
update_config('./config/config.ini', 'Cookie', 'twitcasting_cookie', new_cookie)
|
||||||
anchor_name, live_status = get_data(headers)
|
anchor_name, live_status = get_data(headers)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
print('获取TwitCasting数据失败,正在尝试登录...')
|
print('获取TwitCasting数据失败,正在尝试登录...')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user