Skip to content

Commit 29d0475

Browse files
committed
1 parent 076c38a commit 29d0475

1 file changed

Lines changed: 47 additions & 8 deletions

File tree

Task/txnews.js

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/*
3-
更新时间: 2021-03-17 12:30
3+
更新时间: 2021-03-18 15:03
44
55
腾讯新闻签到修改版,可以自动阅读文章获取红包,该活动为瓜分百万现金挑战赛,针对幸运用户参与,本脚本已不能自动打开红包,需每天要打开腾讯新闻app一次,请须知
66
@@ -13,6 +13,7 @@ let SignArr = [],SignUrl = "";
1313
cookiesArr = [],CookieTxnews = "";
1414
VideoArr = [],SignUrl = "",order = "",
1515
detail = ``, subTitle = ``;
16+
prizeArr = [],prizeUrl= "";
1617
let read_finish = "",video_finish="";
1718
if ($.isNode()) {
1819
if (process.env.TXNEWS_COOKIE && process.env.TXNEWS_COOKIE.indexOf('&') > -1) {
@@ -48,7 +49,8 @@ if ($.isNode()) {
4849
} else {
4950
cookiesArr.push($.getdata('sy_cookie_txnews'));
5051
SignArr.push($.getdata('sy_signurl_txnews'));
51-
VideoArr.push($.getdata('video_txnews'))
52+
VideoArr.push($.getdata('video_txnews'));
53+
prizeArr.push($.getdata('prize_txnews'))
5254
}
5355

5456
let isGetCookie = typeof $request !== 'undefined'
@@ -76,12 +78,14 @@ if (isGetCookie) {
7678
cookieVal = cookiesArr[i];
7779
signurlVal = SignArr[i];
7880
videoVal = VideoArr[i];
81+
prizeVal = prizeArr[i]
7982
$.index = i + 1;
8083
console.log(`-------------------------\n\n开始【腾讯新闻账号${$.index}】`)
8184
ID = signurlVal.match(/devid=[a-zA-Z0-9_-]+/g)[0]
8285
token = signurlVal.split("mac")[1]
8386
await getsign();
84-
await open();
87+
prizeVal?await open():"";
88+
prizeVal?await treesign():"";
8589
await activity();
8690
await getTotal();
8791
await $.wait(1000);
@@ -100,7 +104,12 @@ if (isGetCookie) {
100104

101105

102106
function GetCookie() {
103-
if ($request && $request.body.indexOf("article_read") > -1) {
107+
if ($request && $request.url.indexOf("api.prize.qq.com") > -1) {
108+
const prizeVal = $request.url
109+
$.log(`prizeVal:${prizeVal}`)
110+
if (prizeVal) $.setdata(prizeVal, 'prize_txnews')
111+
$.msg($.name, `获取天天领红包地址: 成功🎉`, ``)
112+
} else if ($request && $request.body.indexOf("article_read") > -1) {
104113
const signurlVal = $request.url
105114
const cookieVal = $request.headers['Cookie'];
106115
$.log(`signurlVal:${signurlVal}`)
@@ -109,7 +118,7 @@ function GetCookie() {
109118
if (cookieVal) $.setdata(cookieVal, 'sy_cookie_txnews')
110119
$.msg($.name, `获取Cookie: 成功🎉`, ``)
111120
}
112-
if ($request && $request.body.indexOf("video_read") > -1) {
121+
else if ($request && $request.body.indexOf("video_read") > -1) {
113122
const videoVal = $request.url
114123
$.log(`videoVal:${videoVal}`)
115124
if (videoVal) $.setdata(videoVal, 'video_txnews')
@@ -165,30 +174,60 @@ function getsign() {
165174
function open() {
166175
return new Promise((resolve, reject) => {
167176
let url = {
168-
url: "https://api.prize.qq.com/v1/newsapp/chajianrp/sendprize?startarticletype=5&mac="+token,
177+
url: prizeVal,
169178
headers: {
170179
Cookie: cookieVal,
171180
'Host': "api.prize.qq.com",
172181
'Content-Type': 'application/x-www-form-urlencoded'
173182
},
174183
body: "actname=chajian_shouqi"
175184
}
176-
$.post(url, (error, resp, data) => {
185+
$.post(url, async(error, resp, data) => {
177186
if(resp.statusCode ==200){
178187
obj = JSON.parse(data);
179188
if(obj.code==0){
180189
amount = obj.data.type=="rp" ? "天天领红包获得"+obj.data.amount/100+"元": "天天领红包获得"+obj.data.amount+"个金币"
181190
$.log(amount)
182191
$.msg($.name, amount,"")
183192
}
184-
} else {
193+
} else if(resp.statusCode !== 403){
194+
$.log(JSON.stringify(resp,null,2))
195+
}
196+
resolve()
197+
})
198+
})
199+
}
200+
201+
function treesign() {
202+
return new Promise((resolve, reject) => {
203+
treetoken = prizeVal.split("?")[1]
204+
let url = {
205+
url: 'https://api.prize.qq.com/v1/newsapp/tree/sign?'+treetoken,
206+
headers: {
207+
Cookie: cookieVal,
208+
'Host': "api.prize.qq.com",
209+
'Content-Type': 'application/x-www-form-urlencoded'
210+
},
211+
body: "current_day="+Math.round(new Date(new Date().toLocaleDateString()).getTime()/1000).toString()
212+
}
213+
$.post(url, (error, resp, data) => {
214+
if(resp.statusCode ==200){
215+
obj = JSON.parse(data);
216+
if(obj.code==0){
217+
amount = obj.data.prize_type=="10" ? "摇钱树签到"+obj.data.prize_num+"经验": "摇钱树签到获得收益"+obj.data.prize_num
218+
$.log(data)
219+
$.msg($.name, amount,"")
220+
}
221+
} else if(resp.statusCode !== 403){
185222
$.log(JSON.stringify(resp,null,2))
186223
}
187224
resolve()
188225
})
189226
})
190227
}
191228

229+
230+
192231
function activity() {
193232
return new Promise((resolve, reject) => {
194233
$.get(Host('user/task/list?'), async(error, resp, data) => {

0 commit comments

Comments
 (0)