-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrrtv 2.js
179 lines (168 loc) · 6.57 KB
/
rrtv 2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
const cookieName = '人人视频'
const cookieKey = 'chavy_cookie_rrtv'
const chavy = init()
let cookieVal = chavy.getdata(cookieKey)
const signinfo = {}
sign()
function sign() {
signdaily()
signwelfare()
check()
}
function signdaily() {
let url = { url: `https://api.rr.tv/rrtv-activity/sign/sign`, headers: { token: cookieVal } }
url.headers['clientType'] = `ios_rrsp_jzsp`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Connection'] = `keep-alive`
url.headers['clientVersion'] = `4.3.5`
url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8`
url.headers['Origin'] = `https://mobile.rr.tv`
url.headers['Referer'] = `https://mobile.rr.tv/`
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Host'] = `api.rr.tv`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Content-Length'] = `12`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5'
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, signdaily.data: ${data}`)
signinfo.signdaily = JSON.parse(data)
})
}
function signwelfare() {
let url = { url: `https://api.rr.tv/dailyWelfare/getWelfare`, headers: { token: cookieVal } }
url.headers['clientType'] = `web`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Connection'] = `keep-alive`
url.headers['clientVersion'] = `0.0.1`
url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8`
url.headers['Origin'] = `https://mobile.rr.tv`
url.headers['Referer'] = `https://mobile.rr.tv/mission/`
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Host'] = `api.rr.tv`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Content-Length'] = `45`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5'
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, signwelfare.data: ${data}`)
signinfo.signwelfare = JSON.parse(data)
})
}
function check(checkms = 0) {
if (signinfo.signdaily && signinfo.signwelfare) {
getinfo()
} else {
if (checkms > 5000) {
chavy.msg(`${cookieName}`, `签到失败: 超时退出`, ``)
chavy.done()
} else {
setTimeout(() => check(checkms + 100), 100)
}
}
}
function getinfo() {
let url = { url: `https://api.rr.tv/user/profile`, headers: { token: cookieVal } }
url.headers['clientType'] = `ios_rrsp_jzsp`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Connection'] = `keep-alive`
url.headers['clientVersion'] = `4.3.5`
url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8`
url.headers['Origin'] = `https://mobile.rr.tv`
url.headers['Referer'] = `https://mobile.rr.tv/`
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Host'] = `api.rr.tv`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Content-Length'] = `0`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5'
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, userinfo: ${data}`)
const result = JSON.parse(data)
const title = `${cookieName}`
let subTitle = ``
let detail = ``
if (signinfo.signdaily) {
subTitle = `每日签到: `
if (signinfo.signdaily.code == '0000' || signinfo.signdaily.code == '8750') {
subTitle += signinfo.signdaily.code == '0000' ? '成功; ' : ''
subTitle += signinfo.signdaily.code == '8750' ? '重复; ' : ''
} else {
subTitle += '失败; '
}
}
if (signinfo.signwelfare) {
subTitle += `每日福利: `
if (signinfo.signwelfare.code == '0000' || signinfo.signwelfare.code == '8623') {
subTitle += signinfo.signwelfare.code == '0000' ? '成功; ' : ''
subTitle += signinfo.signwelfare.code == '8623' ? '重复; ' : ''
} else {
subTitle += '失败;'
}
}
if (result.code == '0000') {
const levelStr = result.data.user.levelStr ? ` (${result.data.user.levelStr})` : ``
detail = `等级: ${result.data.user.level}${levelStr}, 积分: ${result.data.user.score}`
} else {
detail = `编码: ${result.code}, 说明: ${result.msg}`
}
chavy.msg(title, subTitle, detail)
// if (signresult.code == '0000') {
// const levelStr = result.data.user.levelStr ? ` (${result.data.user.levelStr})` : ``
// subTitle = `签到结果: 成功`
// detail = `等级: ${result.data.user.level}${levelStr}, 说明: ${signresult.msg}`
// } else if (signresult.code == '8750') {
// const levelStr = result.data.user.levelStr ? ` (${result.data.user.levelStr})` : ``
// subTitle = `签到结果: 成功 (重复签到)`
// detail = `等级: ${result.data.user.level}${levelStr}, 说明: ${signresult.msg}`
// } else if (signresult.code == '8400') {
// subTitle = `签到失败: 失败`
// detail = `说明: ${signresult.msg}`
// } else {
// subTitle = `签到失败: 未知`
// detail = `编码: ${signresult.code}, 说明: ${signresult.msg}`
// }
// chavy.msg(title, subTitle, detail)
})
chavy.done()
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
}