Skip to content

Commit 1a1510d

Browse files
committed
更新[趣头条],添加早睡早起接口
1 parent bb4aa65 commit 1a1510d

1 file changed

Lines changed: 119 additions & 20 deletions

File tree

‎qtt/qtt.js‎

Lines changed: 119 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ const luckyUrlVal = 'https://qtt-turntable.qutoutiao.net/press_trigger?' + vsign
2424
const luckyRewardVal = 'https://qtt-turntable.qutoutiao.net/extra_reward?' + vsign
2525
const raindropVal = 'https://work-for-coin.1sapp.com/raindrop/v1/click?sub_id=2&type=2&scene_id=2&' + vsign
2626
const loginVal = 'https://api.1sapp.com/app/user/info/member/v1/get?' + vsign
27+
const sleepNightVal = 'https://cj-activity.1sapp.com/v1/zfb/sleep/coin?from=pm&' + vsign
28+
const sleepMorningVal = 'https://cj-activity.1sapp.com/v1/zfb/sleep/coin?from=am&' + vsign
29+
const sleepinitVal = 'https://api.1sapp.com/dlc/ali/zfbSleepInit?' + vsign
2730
const signinfo = {
2831
playList: [],
2932
luckyList: [],
@@ -50,6 +53,14 @@ const signinfo = {
5053
await sleepBag()
5154
}
5255
}
56+
if (new Date().getHours() >= 20) {
57+
await sleepinit()
58+
await sleepNight()
59+
}
60+
if (new Date().getHours() >= 5 && new Date().getHours() <= 9) {
61+
await sleepinit()
62+
await sleepMorning()
63+
}
5364
if (new Date().getHours() == 8 || new Date().getHours() == 14) {
5465
await sleepReward()
5566
}
@@ -101,6 +112,29 @@ function login() {
101112
})
102113
}
103114

115+
//
116+
function sleepinit() {
117+
return new Promise((resolve, reject) => {
118+
const url = {
119+
url: sleepinitVal,
120+
headers: {
121+
'Host': 'api.1sapp.com',
122+
'X-Tk': signXTKVal
123+
}
124+
}
125+
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'
126+
senku.get(url, (error, response, data) => {
127+
try {
128+
resolve()
129+
} catch (e) {
130+
senku.msg(cookieName, `睡觉初始化结果: 失败`, `说明: ${e}`)
131+
senku.log(`❌ ${cookieName} sleepinit - 睡觉初始化失败: ${e}`)
132+
senku.log(`❌ ${cookieName} sleepinit - response: ${JSON.stringify(response)}`)
133+
resolve()
134+
}
135+
})
136+
})
137+
}
104138
// 睡觉
105139
function sleep() {
106140
return new Promise((resolve, reject) => {
@@ -126,6 +160,56 @@ function sleep() {
126160
})
127161
})
128162
}
163+
// 早睡
164+
function sleepNight() {
165+
return new Promise((resolve, reject) => {
166+
const url = {
167+
url: sleepNightVal,
168+
headers: {
169+
'Host': 'cj-activity.1sapp.com',
170+
'X-Tk': signXTKVal
171+
}
172+
}
173+
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'
174+
senku.get(url, (error, response, data) => {
175+
try {
176+
senku.log(`❕ ${cookieName} sleepNight - response: ${JSON.stringify(response)}`)
177+
signinfo.sleepNight = JSON.parse(data)
178+
resolve()
179+
} catch (e) {
180+
senku.msg(cookieName, `早睡结果: 失败`, `说明: ${e}`)
181+
senku.log(`❌ ${cookieName} sleepNight - 早睡失败: ${e}`)
182+
senku.log(`❌ ${cookieName} sleepNight - response: ${JSON.stringify(response)}`)
183+
resolve()
184+
}
185+
})
186+
})
187+
}
188+
// 早起
189+
function sleepMorning() {
190+
return new Promise((resolve, reject) => {
191+
const url = {
192+
url: sleepMorningVal,
193+
headers: {
194+
'Host': 'cj-activity.1sapp.com',
195+
'X-Tk': signXTKVal
196+
}
197+
}
198+
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'
199+
senku.get(url, (error, response, data) => {
200+
try {
201+
senku.log(`❕ ${cookieName} sleepMorning - response: ${JSON.stringify(response)}`)
202+
signinfo.sleepMorning = JSON.parse(data)
203+
resolve()
204+
} catch (e) {
205+
senku.msg(cookieName, `早起结果: 失败`, `说明: ${e}`)
206+
senku.log(`❌ ${cookieName} sleepMorning - 早起失败: ${e}`)
207+
senku.log(`❌ ${cookieName} sleepMorning - response: ${JSON.stringify(response)}`)
208+
resolve()
209+
}
210+
})
211+
})
212+
}
129213
// 睡觉金币
130214
function sleepReward() {
131215
return new Promise((resolve, reject) => {
@@ -366,7 +450,7 @@ function getcoininfo() {
366450
url: coinUrlVal,
367451
headers: {
368452
'Host': 'api.1sapp.com',
369-
'X-Tk': signXTKKey
453+
'X-Tk': signXTKVal
370454
}
371455
}
372456
senku.get(url, (error, response, data) => {
@@ -416,7 +500,7 @@ function signLucky() {
416500
url: luckyUrlVal,
417501
headers: {
418502
'Host': 'qtt-turntable.qutoutiao.net',
419-
'X-Tk': signXTKKey
503+
'X-Tk': signXTKVal
420504
}
421505
}
422506
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'
@@ -469,7 +553,7 @@ function getinfo() {
469553
url: getinfoUrlVal,
470554
headers: {
471555
'Host': 'api.1sapp.com',
472-
'X-Tk': signXTKKey
556+
'X-Tk': signXTKVal
473557
}
474558
}
475559
senku.get(url, (error, response, data) => {
@@ -496,7 +580,7 @@ function playone() {
496580
url: urlParameter,
497581
headers: {
498582
'Host': 'api.1sapp.com',
499-
'X-Tk': signXTKKey
583+
'X-Tk': signXTKVal
500584
}
501585
}
502586
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'
@@ -522,7 +606,7 @@ function playtwo() {
522606
url: urlParameter,
523607
headers: {
524608
'Host': 'api.1sapp.com',
525-
'X-Tk': signXTKKey
609+
'X-Tk': signXTKVal
526610
}
527611
}
528612
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'
@@ -548,7 +632,7 @@ function playthree() {
548632
url: urlParameter,
549633
headers: {
550634
'Host': 'api.1sapp.com',
551-
'X-Tk': signXTKKey
635+
'X-Tk': signXTKVal
552636
}
553637
}
554638
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'
@@ -574,7 +658,7 @@ function playfour() {
574658
url: urlParameter,
575659
headers: {
576660
'Host': 'api.1sapp.com',
577-
'X-Tk': signXTKKey
661+
'X-Tk': signXTKVal
578662
}
579663
}
580664
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'
@@ -606,34 +690,34 @@ function tTime(timestamp) {
606690

607691
// 通知信息部分
608692
function showmsg() {
609-
let subTitle = ''
610-
let detail = ''
693+
let subTitle = ``
694+
let detail = ``
611695
const name = signinfo.login.data.nickname ? signinfo.login.data.nickname : `未设置昵称或Cookie失效`
612696
// signDayMsg
613697
if (signinfo.info && signinfo.info.data.signIn.today == 1) {
614698
if (signinfo.signDay.code == 0) {
615-
subTitle += subTitle == '' ? '' : ' '
699+
subTitle += subTitle == `` ? `` : ` `
616700
const continuation = signinfo.info.data.signIn.continuation
617701
const amount = signinfo.info.data.signIn.amount
618702
const currentCoin = amount[continuation]
619703
const nextCoin = amount[continuation + 1]
620704
const coins = signinfo.info.data.show_balance_info.coins
621-
subTitle += '每日:成功'
705+
subTitle += `每日:成功`
622706
detail += `【每日签到】获得${currentCoin}💰,明日可得${nextCoin}💰\n`
623-
} else subTitle += ''
707+
} else subTitle += ``
624708
} else {
625-
subTitle += '每日:失败'
709+
subTitle += `每日:失败`
626710
senku.log(`❌ ${cookieName} showmsg - 每日签到: ${JSON.stringify(signinfo.signDay)}`)
627711
}
628712

629713
// signHourMsg
630-
subTitle += subTitle == '' ? '' : ' '
714+
subTitle += subTitle == `` ? `` : ` `
631715
if (signinfo.signHour && signinfo.signHour.code == 0) {
632716
subTitle += '时段:成功'
633717
const amount = signinfo.signHour.data.amount
634718
const next_time = tTime(signinfo.signHour.data.next_time)
635719
detail += `【时段签到】获得${amount}💰,下次签到:${next_time}\n`
636-
} else subTitle += '时段:时间未到'
720+
} else subTitle += `时段:时间未到`
637721

638722
// readMsg
639723
if (signinfo.read && signinfo.read.data.status_code == 0) {
@@ -646,7 +730,7 @@ function showmsg() {
646730

647731
} else detail += `【阅读详情】${desc},手动获取金币\n`
648732
}
649-
} else detail += '【阅读详情】失败\n'
733+
} else detail += `【阅读详情】失败\n`
650734

651735
// sleepMsg
652736
if (signinfo.sleep && signinfo.sleep.data.success) {
@@ -667,6 +751,20 @@ function showmsg() {
667751
} else {
668752
detail += `【睡觉结果】失败\n`
669753
}
754+
// 早睡
755+
if (signinfo.sleepNight && signinfo.sleepNight.code == 0) {
756+
if (signinfo.sleepNight.data && signinfo.sleepNight.data.coin) {
757+
const coin = signinfo.sleepNight.data.coin
758+
coin == 0 ? detail += `` : detail += `【早睡结果】获得${coin}💰\n`
759+
}
760+
}
761+
// 早起
762+
if (signinfo.sleepMorning && signinfo.sleepMorning.code == 0) {
763+
if (signinfo.sleepMorning.data && signinfo.sleepMorning.data.coin) {
764+
const coin = signinfo.sleepMorning.data.coin
765+
coin == 0 ? detail += `` : detail += `【早起结果】获得${coin}💰\n`
766+
}
767+
}
670768

671769
// rainDropMsg
672770
if (signinfo.rainList) {
@@ -690,7 +788,7 @@ function showmsg() {
690788
detail += `【首页奖励】时间未到\n`
691789
} else if (signinfo.navCoin && signinfo.navCoin.code == -2) {
692790
detail += `【首页奖励】Cookie失效\n`
693-
} else detail += '【首页奖励】失败或Cookie不存在\n'
791+
} else detail += `【首页奖励】失败或Cookie不存在\n`
694792

695793
// signLuckyMsg
696794
subTitle += subTitle == '' ? '' : ' '
@@ -716,7 +814,7 @@ function showmsg() {
716814
} else detail += `【转盘额外】未知错误\n`
717815
i += 1
718816
}
719-
} else detail += '【转盘额外】失败'
817+
} else detail += `【转盘额外】失败`
720818

721819
// playAdsMsg
722820
subTitle += subTitle == '' ? '' : ' '
@@ -732,13 +830,14 @@ function showmsg() {
732830
}
733831
}
734832
detail += `【账户详情】共计:${coins}💰,连续签到${continuation}天`
735-
} else if (signinfo.playList[0].code == -126) subTitle += '广告:权限错误'
736-
} else subTitle += '广告:失败'
833+
} else if (signinfo.playList[0].code == -126) subTitle += `广告:权限错误`
834+
} else subTitle += `广告:失败`
737835

738836
senku.msg(cookieName + ` 用户:${name}`, subTitle, detail)
739837
senku.done()
740838
}
741839

840+
742841
function init() {
743842
isSurge = () => {
744843
return undefined === this.$httpClient ? false : true

0 commit comments

Comments
 (0)