mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-04 21:01:17 +08:00
fix: 修改COOKIE读取方式
This commit is contained in:
parent
58f73319f4
commit
8d29a1ec6c
BIN
.github/update_fork.png
vendored
Normal file
BIN
.github/update_fork.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
15
.github/workflows/node.js.yml
vendored
15
.github/workflows/node.js.yml
vendored
@ -21,7 +21,8 @@ jobs:
|
||||
- name: 'Run in Nodejs'
|
||||
shell: bash
|
||||
env:
|
||||
COOKIE_1: ${{ secrets.COOKIE }}
|
||||
NUMBER: 1
|
||||
COOKIE: ${{ secrets.COOKIE }}
|
||||
SCKEY: ${{ secrets.SCKEY }}
|
||||
run:
|
||||
npm start
|
||||
@ -37,7 +38,8 @@ jobs:
|
||||
- name: 'Run in Nodejs'
|
||||
shell: bash
|
||||
env:
|
||||
COOKIE_2: ${{ secrets.COOKIE2 }}
|
||||
NUMBER: 2
|
||||
COOKIE: ${{ secrets.COOKIE2 }}
|
||||
SCKEY: ${{ secrets.SCKEY }}
|
||||
run:
|
||||
npm start
|
||||
@ -53,7 +55,8 @@ jobs:
|
||||
- name: 'Run in Nodejs'
|
||||
shell: bash
|
||||
env:
|
||||
COOKIE_3: ${{ secrets.COOKIE3 }}
|
||||
NUMBER: 3
|
||||
COOKIE: ${{ secrets.COOKIE3 }}
|
||||
SCKEY: ${{ secrets.SCKEY }}
|
||||
run:
|
||||
npm start
|
||||
@ -69,7 +72,8 @@ jobs:
|
||||
- name: 'Run in Nodejs'
|
||||
shell: bash
|
||||
env:
|
||||
COOKIE_4: ${{ secrets.COOKIE4 }}
|
||||
NUMBER: 4
|
||||
COOKIE: ${{ secrets.COOKIE4 }}
|
||||
SCKEY: ${{ secrets.SCKEY }}
|
||||
run:
|
||||
npm start
|
||||
@ -85,7 +89,8 @@ jobs:
|
||||
- name: 'Run in Nodejs'
|
||||
shell: bash
|
||||
env:
|
||||
COOKIE_5: ${{ secrets.COOKIE5 }}
|
||||
NUMBER: 5
|
||||
COOKIE: ${{ secrets.COOKIE5 }}
|
||||
SCKEY: ${{ secrets.SCKEY }}
|
||||
run:
|
||||
npm start
|
||||
|
||||
16
README.md
16
README.md
@ -1,5 +1,6 @@
|
||||
# AutoScript
|
||||

|
||||

|
||||
|
||||
- [AutoScript](#autoscript)
|
||||
- [动态抽奖](#动态抽奖)
|
||||
@ -18,7 +19,7 @@
|
||||
|
||||
> [Actions官方文档](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions)
|
||||
|
||||
此脚本将在B站专栏草稿中储存信息
|
||||
此脚本将在B站专栏草稿中储存转发过的动态id以防止重复转发
|
||||
|
||||
---
|
||||
|
||||
@ -96,7 +97,9 @@ Chrome浏览器:
|
||||
如果出现
|
||||

|
||||
说明此脚本有更新
|
||||
自行搜索`如何同步更新Github上Fork的项目`
|
||||
通过`Pull Request`更新仓库
|
||||

|
||||
|
||||
- 默认支持5个账号
|
||||
| cookies | value |
|
||||
| --------- | ----- |
|
||||
@ -105,8 +108,10 @@ Chrome浏览器:
|
||||
| `COOKIE3` | 值 |
|
||||
| `COOKIE4` | 值 |
|
||||
| `COOKIE5` | 值 |
|
||||
| `COOKIE*` | 值 |
|
||||
|
||||
也可在`.github/workflows/node.js.yml`中
|
||||
*添加更多的账号*
|
||||
可在`.github/workflows/node.js.yml`中
|
||||
```yaml
|
||||
lottery_*:
|
||||
runs-on: ubuntu-latest
|
||||
@ -120,13 +125,14 @@ Chrome浏览器:
|
||||
- name: 'Run in Nodejs'
|
||||
shell: bash
|
||||
env:
|
||||
COOKIE_*: ${{ secrets.COOKIE* }}
|
||||
NUMBER: *
|
||||
COOKIE: ${{ secrets.COOKIE* }}
|
||||
SCKEY: ${{ secrets.SCKEY }}
|
||||
run:
|
||||
npm start
|
||||
```
|
||||
将以上星号处改为数字并依次复制粘贴
|
||||
此时secret里就可以添加更多的Cookie(简单的找规律问题)
|
||||
此时`Secrets`里就可以添加更多的`COOKIE*`(简单的找规律问题)
|
||||
|
||||
- 部分设置说明
|
||||
- 定时运行(`UTC`时间)
|
||||
|
||||
@ -76,7 +76,7 @@ async function isMe() {
|
||||
|
||||
/**
|
||||
* 检查cookie是否有效
|
||||
* @param {number} num
|
||||
* @param {string} num
|
||||
*/
|
||||
async function checkCookie(num) {
|
||||
if (await BiliAPI.getMyinfo()) {
|
||||
|
||||
22
main.js
22
main.js
@ -1,23 +1,13 @@
|
||||
const setGlobalVar = require("./lib/setCookie");
|
||||
|
||||
const { SCKEY } = process.env;
|
||||
const { NUMBER, COOKIE, SCKEY } = process.env;
|
||||
|
||||
const COOKIE_ARR = (function () {
|
||||
let ret = []
|
||||
for (let i = 1; i < 10000; i++) {
|
||||
const cookie = process.env['COOKIE_' + i];
|
||||
if (typeof cookie === 'undefined') break;
|
||||
ret.push(cookie);
|
||||
}
|
||||
return ret;
|
||||
})()
|
||||
|
||||
COOKIE_ARR.forEach(async (cookie, num) => {
|
||||
if (typeof cookie === 'string' && cookie.length > 10) {
|
||||
await setGlobalVar(cookie, SCKEY);
|
||||
((async () => {
|
||||
if (typeof COOKIE === 'string' && COOKIE.length > 10) {
|
||||
await setGlobalVar(COOKIE, SCKEY);
|
||||
const { start, isMe, checkCookie } = require("./lib/lottery-in-nodejs");
|
||||
const { clear } = require("./lib/clear");
|
||||
const isRight = await checkCookie(num + 1);
|
||||
const isRight = await checkCookie(NUMBER);
|
||||
if (!isRight) return;
|
||||
await isMe();
|
||||
if (process.argv.slice(2)[0] === 'clear') {
|
||||
@ -29,4 +19,4 @@ COOKIE_ARR.forEach(async (cookie, num) => {
|
||||
await start();
|
||||
}
|
||||
}
|
||||
});
|
||||
}))();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user