Skip to content

Commit b776510

Browse files
committed
更新[趣头条],添加阅读篇数
1 parent ee2520d commit b776510

3 files changed

Lines changed: 96 additions & 20 deletions

File tree

‎qtt/README.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
1515
> 2020.04.13 简化Cookie获取方式
1616
17+
> 2020.04.14 添加阅读篇数
18+
1719
## 配置 (Surge)
1820

1921
```properties
@@ -22,7 +24,7 @@ api.1sapp.com
2224

2325
[Script]
2426
http-request ^https:\/\/api\.1sapp\.com\/sign\/info? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/qtt/qtt.cookie.js
25-
27+
http-request ^https:\/\/api\.1sapp\.com\/content\/readV2? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/qtt/qtt.cookie.js
2628
cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/qtt/qtt.js
2729
```
2830

@@ -36,9 +38,11 @@ api.1sapp.com
3638

3739
# [商店版] QuanX v1.0.6-build194 及更早版本
3840
^https:\/\/api\.1sapp\.com\/sign\/info? url script-request-header qtt.cookie.js
41+
^https:\/\/api\.1sapp\.com\/content\/readV2? url script-request-header qtt.cookie.js
3942

4043
# [TestFlight] QuanX v1.0.6-build195 及以后版本
4144
^https:\/\/api\.1sapp\.com\/sign\/info? url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/qtt/qtt.cookie.js
45+
^https:\/\/api\.1sapp\.com\/content\/readV2? url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/qtt/qtt.cookie.js
4246

4347
[task_local]
4448
1 0 * * * qtt.js
@@ -55,6 +59,7 @@ api.1sapp.com
5559
5. 把获取 Cookie 的脚本注释掉
5660
6. 运行一次脚本, 如果提示重复签到, 那就算成功了!
5761
7. 建议将`task`执行次数改成每小时执行防止错过奖励
62+
8. 阅读篇数获取Cookie:`小视频`中播放一段时间视频即可获取,具体的阅读篇数奖励请到应用内手动点击
5863

5964
> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie.
6065

‎qtt/qtt.cookie.js‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const cookieName = '趣头条'
22
const signKey = 'senku_signKey_qtt'
33
const signXTKKey = 'senku_signXTK_qtt'
4+
const readKey = 'senku_readKey_qtt'
45
const senku = init()
56

67
const requrl = $request.url
@@ -9,16 +10,29 @@ if ($request && $request.method != 'OPTIONS') {
910
const tokenVal = '&' + requrl.match(/token=[a-zA-Z0-9_-]+/)[0]
1011
const uuidVal = '&' + requrl.match(/uuid=[a-zA-Z0-9_-]+/)[0]
1112
const signVal = tokenVal + uuidVal
12-
const signXTKVal = requrl.match(/tk=[a-zA-Z0-9_-]+/)[0]
13+
const XTK = requrl.match(/tk=[a-zA-Z0-9_-]+/)[0]
14+
const signXTKVal = XTK.substring(3, XTK.length)
1315
if (signVal) senku.setdata(signVal, signKey)
1416
if (signXTKVal) senku.setdata(signXTKVal, signXTKKey)
15-
senku.msg(cookieName, `获取Cookie: 成功`, ``)
17+
senku.msg(cookieName, `签到,获取Cookie: 成功`, ``)
1618
senku.log(`🔔${signVal},🔔${signXTKVal}`)
1719
} catch (error) {
1820
senku.log(`❌error:${error}`)
1921
}
2022
}
2123

24+
if ($request && $request.method != 'OPTIONS' && requrl.match(/\/content\/readV2\?qdata=[a-zA-Z0-9_-]+/)) {
25+
try {
26+
const readVal = requrl
27+
if (readVal) {
28+
if (senku.setdata(readVal, readKey))
29+
senku.msg(cookieName, `阅读,获取Cookie: 成功`, ``)
30+
senku.log(`🔔${readVal}`)
31+
}
32+
} catch (error) {
33+
senku.log(`❌error:${error}`)
34+
}
35+
}
2236
function init() {
2337
isSurge = () => {
2438
return undefined === this.$httpClient ? false : true

‎qtt/qtt.js‎

Lines changed: 74 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
const cookieName = '趣头条'
44
const signKey = 'senku_signKey_qtt'
55
const signXTKKey = 'senku_signXTK_qtt'
6+
const readKey = 'senku_readKey_qtt'
67
const senku = init()
78
const signVal = senku.getdata(signKey)
89
const signXTKVal = senku.getdata(signXTKKey)
10+
const readVal = senku.getdata(readKey)
911
const signurlVal = 'https://api.1sapp.com/sign/sign?version=30967000&xhi=200' + signVal
1012
const adUrl = 'https://api.1sapp.com/sign/adDone?version=30967000&xhi=200' + signVal
1113
const getinfoUrlVal = 'https://api.1sapp.com/sign/info?version=30967000&xhi=200' + signVal
12-
const hourUrlVal = 'https://api.1sapp.com/mission/intPointReward?version=30967000&xhi=200' + signVal
14+
const hourUrlVal = 'https://api.1sapp.com/mission/intPointReward?version=30967000&xhi=200&sign=8167814154902b578aed1d6bb694ebee' + signVal
15+
const coinUrlVal = 'https://api.1sapp.com/app/ioscoin/getInfo?version=30967000&xhi=200' + signVal
1316
const signinfo = { playList: [] }
1417
const playUrl = [adUrl + 'pos=one', adUrl + 'pos=two', adUrl + 'pos=three', adUrl + 'pos=four']
1518

@@ -20,8 +23,9 @@ const playUrl = [adUrl + 'pos=one', adUrl + 'pos=two', adUrl + 'pos=three', adUr
2023
await signHour()
2124
await signLucky()
2225
await play()
26+
await read()
2327
await getinfo()
24-
28+
await getcoininfo()
2529
showmsg()
2630
senku.done()
2731
})().catch((e) => senku.log(`❌ ${cookieName} 签到失败: ${e}`), senku.done())
@@ -46,9 +50,29 @@ function signDay() {
4650
})
4751
}
4852

53+
function read() {
54+
return new Promise((resolve, reject) => {
55+
const url = { url: readVal, headers: { 'Host': 'api.1sapp.com', 'X-Tk': signXTKVal } }
56+
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148'
57+
senku.get(url, (error, response, data) => {
58+
try {
59+
senku.log(`❕ ${cookieName} signDay - response: ${JSON.stringify(response)}`)
60+
signinfo.read = JSON.parse(data)
61+
resolve()
62+
} catch (e) {
63+
senku.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
64+
senku.log(`❌ ${cookieName} signDay - 签到失败: ${e}`)
65+
senku.log(`❌ ${cookieName} signDay - response: ${JSON.stringify(response)}`)
66+
resolve()
67+
}
68+
})
69+
})
70+
}
71+
72+
// FIXME: 时段请求偶尔丢失或伪请求
4973
function signHour() {
5074
return new Promise((resolve, reject) => {
51-
const url = { url: hourUrlVal, headers: { 'Host': 'api.1sapp.com', 'X-Tk': signXTKKey } }
75+
const url = { url: hourUrlVal, headers: { 'Host': 'api.1sapp.com', 'X-Tk': signXTKVal } }
5276
senku.get(url, (error, response, data) => {
5377
try {
5478
senku.log(`❕ ${cookieName} signHour - response: ${JSON.stringify(response)}`)
@@ -102,40 +126,64 @@ function getinfo() {
102126
})
103127
}
104128

105-
// 播放广告获取奖励
106-
function playAd(urlParameter) {
129+
function getcoininfo() {
107130
return new Promise((resolve, reject) => {
108-
const url = { url: urlParameter, headers: { 'Host': 'api.1sapp.com', 'X-Tk': signXTKKey } }
131+
const url = { url: coinUrlVal, headers: { 'Host': 'api.1sapp.com', 'X-Tk': signXTKKey } }
109132
senku.get(url, (error, response, data) => {
110133
try {
111-
senku.log(`❕ ${cookieName} playAd - response: ${JSON.stringify(response)}`)
112-
signinfo.playList.push(JSON.parse(data))
134+
senku.log(`❕ ${cookieName} getcoininfo - response: ${JSON.stringify(response)}`)
135+
signinfo.coininfo = JSON.parse(data)
113136
resolve()
114137
} catch (e) {
115138
senku.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
116-
senku.log(`❌ ${cookieName} playAd - 签到失败: ${e}`)
117-
senku.log(`❌ ${cookieName} playAd - response: ${JSON.stringify(response)}`)
139+
senku.log(`❌ ${cookieName} getcoininfo - 签到失败: ${e}`)
140+
senku.log(`❌ ${cookieName} getcoininfo - response: ${JSON.stringify(response)}`)
118141
resolve()
119142
}
120143
})
121144
})
122145
}
123146

147+
// FIXME: 播放广告请求经常性丢失或伪请求
148+
// 播放广告获取奖励
149+
function playAd(urlParameter) {
150+
return new Promise((resolve, reject) => {
151+
setTimeout(() => {
152+
const url = { url: urlParameter, headers: { 'Host': 'api.1sapp.com', 'X-Tk': signXTKKey } }
153+
url.headers['User-Agent'] = 'Mozilla / 5.0(iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit / 605.1.15(KHTML, like Gecko) Mobile / 15E148'
154+
senku.get(url, (error, response, data) => {
155+
try {
156+
senku.log(`❕ ${cookieName} playAd - response: ${JSON.stringify(response)}`)
157+
signinfo.playList.push(JSON.parse(data))
158+
resolve()
159+
} catch (e) {
160+
senku.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
161+
senku.log(`❌ ${cookieName} playAd - 签到失败: ${e}`)
162+
senku.log(`❌ ${cookieName} playAd - response: ${JSON.stringify(response)}`)
163+
resolve()
164+
}
165+
})
166+
}, 100)
167+
})
168+
}
169+
124170
// 播放广告
125171
function play() {
126172
return new Promise((resolve, reject) => {
127-
playUrl.forEach((url) => {
128-
playAd(url)
129-
resolve()
130-
})
173+
setTimeout(() => {
174+
playUrl.forEach((url) => {
175+
playAd(url)
176+
resolve()
177+
})
178+
}, 100)
131179
})
132180
}
133181

134182
// 将时间戳格式化
135183
function tTime(timestamp) {
136184
const date = new Date(timestamp * 1000)
137185
const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
138-
const D = (date.getDate() + 1 < 10 ? '0' + date.getDate() : date.getDate() ) + ' '
186+
const D = (date.getDate() + 1 < 10 ? '0' + date.getDate() : date.getDate()) + ' '
139187
const h = date.getHours() + ':'
140188
const m = (date.getMinutes() + 1 < 10 ? '0' + (date.getMinutes() + 1) : date.getMinutes() + 1) + ''
141189
return M + D + h + m
@@ -173,7 +221,16 @@ function showmsg() {
173221
detail += `时段签到:获得${amount}💰,下次签到:${next_time}`
174222
} else subTitle += '时段:🔕'
175223

176-
// signLuckMsg
224+
// readMsg
225+
detail += detail == '' ? '' : ','
226+
if (signinfo.read && signinfo.read.data.status_code == 0) {
227+
if (signinfo.coininfo.data) {
228+
const desc = signinfo.coininfo.data.content_config.desc
229+
detail += `阅读奖励:${desc}`
230+
}
231+
} else detail += '阅读篇数:失败'
232+
233+
// signLuckyMsg
177234
subTitle += subTitle == '' ? '' : ', '
178235
if (signinfo.signLucky && signinfo.signLucky.code == 1) {
179236
subTitle += `幸运转盘:✅`
@@ -193,7 +250,7 @@ function showmsg() {
193250
const continuation = signinfo.info.data.signIn.continuation
194251
for (const poss of icon) {
195252
const time = tTime(poss.next_time)
196-
moreDetail += `\n视频广告🔕下次🕥${time} 可获得${poss.amount}💰`
253+
moreDetail += `\n【视频广告】下次🕥${time} 可获得${poss.amount}💰`
197254
}
198255
detail += detail == '' ? '' : ', '
199256
detail += `共计:${coins}💰,连续签到${continuation}天`

0 commit comments

Comments
 (0)