Skip to content

Commit

Permalink
更新[腾讯视频]签到脚本&说明 Cookie改为从APP中获取, Cookie有效期待观察
Browse files Browse the repository at this point in the history
  • Loading branch information
chavyleung committed Jan 7, 2020
1 parent fc1723c commit 43502e5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
26 changes: 11 additions & 15 deletions videoqq/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# 腾讯视频 (Surge & QuanX 二合一签到脚本)

**由于获取的 Cookie 只有 2 小时有效期,目前此脚本使用意义不大,先弃坑**
**2020.1.6** **~~从 网页 获取 Cookie 只有 2 小时有效期,使用意义不大,先弃坑~~**

**由于获取的 Cookie 只有 2 小时有效期,目前此脚本使用意义不大,先弃坑**

**由于获取的 Cookie 只有 2 小时有效期,目前此脚本使用意义不大,先弃坑**
**2020.1.7 从 APP 获取 Cookie,目测有效期能撑一段时间 (需要观察)**

> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可
Expand All @@ -14,37 +12,35 @@

```properties
[MITM]
v.qq.com
vip.video.qq.com

[Script]
http-request ^https:\/\/v\.qq\.com\/?.? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/videoqq/videoqq.cookie.js
http-request ^https:\/\/vip\.video\.qq\.com\/?.? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/videoqq/videoqq.cookie.js
cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/videoqq/videoqq.js
```

## 配置 (QuanX)

```properties
[MITM]
v.qq.com
vip.video.qq.com

[rewrite_local]
^https:\/\/v\.qq\.com\/?.? url script-response-body videoqq.cookie.js
^https:\/\/vip\.video\.qq\.com\/?.? url script-response-body videoqq.cookie.js

[task_local]
1 0 * * * videoqq.js
```

## 说明

1. 先在浏览器登录 `(先登录! 先登录! 先登录!)`
- 可以随便找个 vip 视频触发登录: https://m.v.qq.com/x/cover/r/rj8uc45tm8a17wm.html
2. 先把`v.qq.com`加到`[MITM]`
3. 再配置重写规则:
1. 先把`vip.video.qq.com`加到`[MITM]`
2. 再配置重写规则:
- Surge: 把两条远程脚本放到`[Script]`
- QuanX: 把`videoqq.cookie.js``videoqq.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关)
4. 打开浏览器访问: https://v.qq.com
5. 系统提示: `获取Cookie: 成功`
6. 最后就可以把第 1 条脚本注释掉了
3. 打开 APP, 访问下`个人中心`
4. 系统提示: `获取Cookie: 成功` (如果不提示获取成功, 尝试杀进程再进个人中心)
5. 最后就可以把第 1 条脚本注释掉了

> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie.
Expand Down
15 changes: 11 additions & 4 deletions videoqq/videoqq.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function sign() {
let subTitle = ''
let detail = ''
if (result.ret == 0) {
getexp()
getexp(result)
} else if (result.ret == -10006) {
subTitle = '签到结果: 失败'
detail = `原因: 未登录, 说明: ${result.msg}`
Expand All @@ -35,16 +35,23 @@ function sign() {
chavy.done()
}

function getexp() {
function getexp(signresult) {
const timestamp = Date.parse(new Date())
let url = { url: `https://vip.video.qq.com/fcgi-bin/comm_cgi?name=spp_PropertyNum&cmd=1&growth_value=1&otype=json&_=${timestamp}`, headers: { Cookie: cookieVal } }
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15'
chavy.get(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
let result = JSON.parse(data.match(/QZOutputJson=\(([^\)]*)\)/)[1])
const title = `${cookieName}`
let subTitle = '签到结果: 成功'
let detail = `V力值: ${result.GrowthValue.num}, 观影券: ${result.MovieTicket.num}, 赠片资格: ${result.GiveMovie.num}`
let subTitle = ''
let detail = ''
if (signresult.checkin_score) {
subTitle = '签到结果: 成功'
detail = `V力值: ${result.GrowthValue.num} (+${signresult.checkin_score}), 观影券: ${result.MovieTicket.num}, 赠片资格: ${result.GiveMovie.num}`
} else {
subTitle = '签到结果: 成功 (重复签到)'
detail = `V力值: ${result.GrowthValue.num}, 观影券: ${result.MovieTicket.num}, 赠片资格: ${result.GiveMovie.num}`
}
chavy.msg(title, subTitle, detail)
})
}
Expand Down

0 comments on commit 43502e5

Please sign in to comment.