forked from Wenmoux/checkbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
36 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,39 @@ | ||
const axios = require("axios") | ||
function task() { | ||
return new Promise(async resolve => { | ||
try { | ||
let url = 'https://www.hifini.com/sg_sign.htm' | ||
let res = await axios.post(url, "000", { | ||
headers: { | ||
"X-Requested-With": "XMLHttpRequest", | ||
"cookie": config.hifini.cookie | ||
} | ||
}) | ||
msg = res.data.message | ||
console.log(msg) | ||
} catch (err) { | ||
console.log(err) | ||
msg = "签到接口请求出错" | ||
} | ||
resolve("【HiFiNi每日签到】:" + msg) | ||
}) | ||
const axios = require('axios'); | ||
const headers = { | ||
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', | ||
"X-Requested-With": "XMLHttpRequest", | ||
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36', | ||
"cookie": config.hifini.cookie | ||
}; | ||
|
||
async function getSign() { | ||
const url = 'https://www.hifini.com/sg_sign.htm'; | ||
try { | ||
const res = await axios.get(url, {headers}); | ||
const sign = res.data.match(/sign = \"(.*?)\";/); | ||
return sign[1]; | ||
} catch (err) { | ||
console.error("获取sign出错", err); | ||
return null; | ||
} | ||
} | ||
|
||
async function task() { | ||
const url = 'https://www.hifini.com/sg_sign.htm'; | ||
const sign = await getSign(); | ||
if (!sign) return "【HiFiNi每日签到】:签到接口请求出错"; | ||
|
||
try { | ||
const res = await axios.post(url, {sign}, {headers}); | ||
const msg = res.data.message; | ||
console.log(msg); | ||
return "【HiFiNi每日签到】:" + msg; | ||
} catch (err) { | ||
console.error("签到接口请求出错", err); | ||
return "【HiFiNi每日签到】:签到接口请求出错"; | ||
} | ||
} | ||
|
||
module.exports = task; | ||
|
||
|
||
//task() | ||
module.exports = task |