尝试增加对链接型的cookie值进行自动获取处理
This commit is contained in:
parent
0859b62981
commit
5a1240ab77
@ -181,6 +181,16 @@ class CMS:
|
||||
headers[k] = UC_UA
|
||||
elif v == 'IOS_UA':
|
||||
headers[k] = IOS_UA
|
||||
elif str(k).lower() == 'cookie':
|
||||
v = headers[k]
|
||||
if v and str(v).startswith('http'):
|
||||
try:
|
||||
ck = requests.get(v, timeout=timeout, verify=False)
|
||||
headers[k] = ck
|
||||
except Exception as e:
|
||||
logger.info(f'从{v}获取cookie发生错误:{e}')
|
||||
pass
|
||||
|
||||
lower_keys = list(map(lambda x:x.lower(),keys))
|
||||
if not 'user-agent' in lower_keys:
|
||||
headers['User-Agent'] = UA
|
||||
|
||||
@ -1 +1 @@
|
||||
3.9.42beta7
|
||||
3.9.42beta8
|
||||
@ -2045,6 +2045,18 @@ function init(ext) {
|
||||
if(['MOBILE_UA','PC_UA','UC_UA','IOS_UA','UA'].includes(v)){
|
||||
rule.headers[k] = eval(v);
|
||||
}
|
||||
}else if(k.toLowerCase() === 'cookie'){
|
||||
let v = rule.headers[k];
|
||||
if(v && v.startsWith('http')){
|
||||
console.log(v);
|
||||
try {
|
||||
v = fetch(v);
|
||||
console.log(v);
|
||||
rule.headers[k] = v;
|
||||
}catch (e) {
|
||||
console.log(`从${v}获取cookie发生错误:`+e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (e) {
|
||||
|
||||
2
libs/drpy2.min.js
vendored
2
libs/drpy2.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user