更换登录类型
This commit is contained in:
parent
6f9616ccf3
commit
5cf4ab2fc1
15
Common.py
15
Common.py
@ -299,12 +299,21 @@ def appendError(obj):
|
|||||||
def loginBilibili(force=False):
|
def loginBilibili(force=False):
|
||||||
if config["dlO"] is False or forceNotUpload is False:
|
if config["dlO"] is False or forceNotUpload is False:
|
||||||
global loginTime
|
global loginTime
|
||||||
|
global b
|
||||||
if getTimeDelta(datetime.now(), loginTime) < 86400 * 10 and not force:
|
if getTimeDelta(datetime.now(), loginTime) < 86400 * 10 and not force:
|
||||||
return False
|
return False
|
||||||
res = b.login(config["b_u"], config["b_p"])
|
if os.path.exists('cookie'):
|
||||||
|
try:
|
||||||
|
with open('cookie', 'r', encoding='utf8') as f:
|
||||||
|
_cookie = f.read(4096)
|
||||||
|
b = Bilibili(_cookie)
|
||||||
loginTime = datetime.now()
|
loginTime = datetime.now()
|
||||||
appendOperation("登陆账号,结果为:[{}]".format(res))
|
appendOperation("Cookie 登录")
|
||||||
return res
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
appendError(e)
|
||||||
|
appendOperation("Cookie 登录失败")
|
||||||
|
return False
|
||||||
else:
|
else:
|
||||||
appendOperation("设置了不上传,所以不会登陆")
|
appendOperation("设置了不上传,所以不会登陆")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user