Skip to content

Commit 9df0c0c

Browse files
committed
添加[趣头条]时段奖励,建议将task改为每小时执行
1 parent 8e7b63f commit 9df0c0c

2 files changed

Lines changed: 46 additions & 19 deletions

File tree

‎qtt/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
> 2020.04.07 添加签到脚本
1010
11-
> 2020.04.08 添加视频广告奖励
11+
> 2020.04.08 添加视频广告奖励、添加每时段签到奖励
1212
1313
## 配置 (Surge)
1414

@@ -50,7 +50,7 @@ api.1sapp.com
5050
4. 系统提示: `获取Cookie: 成功`
5151
5. 把获取 Cookie 的脚本注释掉
5252
6. 运行一次脚本, 如果提示重复签到, 那就算成功了!
53-
53+
7. 建议将`task`执行次数改成每小时执行防止错过奖励, `10 0-24/1 * * *`
5454
> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie.
5555
5656
> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次.

‎qtt/qtt.js‎

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ const signurlVal = senku.getdata(signurlKey)
77
const signheaderVal = senku.getdata(signheaderKey)
88
const adUrl = signurlVal.replace(/sign\?/, "adDone?").concat("&GUID=58711eba362605e8c3afa9be885.31911288")
99
const getinfoUrlVal = signurlVal.replace(/sign\?/, "info?")
10+
const hourUrlVal = signurlVal.replace("/sign/sign", "/mission/intPointReward")
1011
const signinfo = { playList: [] }
11-
12-
console.log(getinfoUrlVal)
1312
let playUrl = [adUrl.concat("&pos=one"), adUrl.concat("&pos=two"), adUrl.concat("&pos=three"), adUrl.concat("&pos=four")]
1413

1514

1615
; (sign = async () => {
1716
senku.log(`🔔 ${cookieName}`)
1817
await signDay()
18+
await signHour()
1919
await play()
2020
await getinfo()
2121

@@ -42,6 +42,24 @@ function signDay() {
4242
})
4343
}
4444

45+
function signHour() {
46+
return new Promise((resolve, reject) => {
47+
const url = { url: hourUrlVal, headers: JSON.parse(signheaderVal) }
48+
senku.get(url, (error, response, data) => {
49+
try {
50+
senku.log(`❕ ${cookieName} signHour - response: ${JSON.stringify(response)}`)
51+
signinfo.signHour = JSON.parse(data)
52+
resolve()
53+
} catch (e) {
54+
senku.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
55+
senku.log(`❌ ${cookieName} signHour - 签到失败: ${e}`)
56+
senku.log(`❌ ${cookieName} signHour - response: ${JSON.stringify(response)}`)
57+
resolve()
58+
}
59+
})
60+
})
61+
}
62+
4563
function getinfo() {
4664
return new Promise((resolve, reject) => {
4765
const url = { url: getinfoUrlVal, headers: JSON.parse(signheaderVal) }
@@ -93,52 +111,61 @@ function play() {
93111
function tTime(timestamp) {
94112
const date = new Date(timestamp * 1000)
95113
const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
96-
const D = date.getDate() + ' '
114+
const D = date.getDate() + '-'
97115
const h = date.getHours() + ':'
98-
const m = date.getMinutes() + ':'
99-
const s = date.getSeconds()
100-
return M + D + h + m + s
116+
const m = date.getMinutes() + ''
117+
return M + D + h + m
101118
}
102119

103120
function showmsg() {
104121
let subTitle = ''
105122
let detail = ''
106123
let moreDetail = ''
107-
// signDay
124+
// signDayMsg
108125
if (signinfo.info && signinfo.info.data.signIn.today == 1) {
109126
if (signinfo.signDay.code == 0) {
110127
const continuation = signinfo.info.data.signIn.continuation
111128
const amount = signinfo.info.data.signIn.amount
112129
const currentCoin = amount[continuation]
113130
const nextCoin = amount[continuation + 1]
114131
const coins = signinfo.info.data.show_balance_info.coins
115-
subTitle = '签到: 成功'
132+
subTitle = '每日:✅'
116133
detail += detail == '' ? '' : ', '
117-
detail += `获得${currentCoin}金币,下次:${nextCoin},总共:${coins}连续签到${continuation}天`
134+
detail += `每日签到:获得${currentCoin}💰,明日可得${nextCoin}💰,共计:${coins}💰连续签到${continuation}天`
118135
}
119-
else subTitle = '签到: 重复'
136+
else subTitle = '每日:🔄'
120137
} else {
121-
subTitle = '签到: 失败'
138+
subTitle = '每日:❌'
122139
senku.log(`❌ ${cookieName} showmsg - 每日签到: ${JSON.stringify(signinfo.signDay)}`)
123140
}
124141

125-
// playAds
142+
// signHourMsg
143+
subTitle += subTitle == '' ? '' : ', '
144+
if (signinfo.signHour && signinfo.signHour.code == 0) {
145+
subTitle += '时段:✅'
146+
detail += detail == '' ? '' : ','
147+
const amount = signinfo.signHour.data.amount
148+
const next_time = tTime(signinfo.signHour.data.next_time)
149+
detail += `时段签到:获得${amount}💰,下次签到:${next_time}`
150+
} else subTitle += '时段:🔕'
151+
152+
// playAdsMsg
126153
subTitle += subTitle == '' ? '' : ', '
127154
if (signinfo.playList) {
128-
subTitle += '广告奖励: 成功'
155+
subTitle += '广告:✅'
129156
moreDetail += moreDetail == '' ? '' : '\n'
130157
const icon = signinfo.info.data.signIn.ext_ad.icon
131158
const coins = signinfo.info.data.show_balance_info.coins
132159
const continuation = signinfo.info.data.signIn.continuation
133160
for (const poss of icon) {
134161
const time = tTime(poss.next_time)
135-
moreDetail += `\n视频${poss.pos}: 下次签到时间${time},可获得${poss.amount}`
162+
moreDetail += `\n视频广告🔕下次🕥${time} 可获得${poss.amount}💰`
136163
}
137164
detail += detail == '' ? '' : ', '
138-
detail += `总共:${coins}连续签到${continuation}天`
139-
} else subTitle += '广告奖励: 失败'
165+
detail += `共计:${coins}💰,连续签到${continuation}天`
166+
} else subTitle += '广告:❌'
140167

141-
if (moreDetail) detail += `\n查看签到详情\n${moreDetail}`
168+
if (moreDetail) detail += `\n查看签到详情${moreDetail}`
142169
senku.msg(cookieName, subTitle, detail)
143170
senku.done()
144171
}

0 commit comments

Comments
 (0)