mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-07-22 21:13:47 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df3e97d3bf | ||
|
|
5a86a0407a | ||
|
|
d9f6bf247c | ||
|
|
ded981e4d7 | ||
|
|
93d372761a | ||
|
|
e9c341dce0 | ||
|
|
60e211ef3a | ||
|
|
5aa50484fe | ||
|
|
5b33ae3bb6 | ||
|
|
7e4650ced4 | ||
|
|
364bcd1325 | ||
|
|
469a6dc7b5 | ||
|
|
7a8682ce76 | ||
|
|
7b6356ac25 | ||
|
|
d337fb235d | ||
|
|
d9dba6f0ff | ||
|
|
eafa7c7ae4 | ||
|
|
e2976cc9b7 | ||
|
|
759a87140e | ||
|
|
f5bdd289d5 | ||
|
|
cb6fad05e4 | ||
|
|
780a3a9840 | ||
|
|
92fab1774d | ||
|
|
addb9c65fe | ||
|
|
b86e756520 | ||
|
|
f3af8dff17 | ||
|
|
5d30178bd3 | ||
|
|
0c610701cb | ||
|
|
6dfee7efb8 | ||
|
|
13e847825b | ||
|
|
6496a8f0bc |
@@ -16,7 +16,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- name: Set up Docker Buildx
|
||||
@@ -31,4 +31,4 @@ jobs:
|
||||
with:
|
||||
push: true
|
||||
tags: ${{ secrets.DOCKERHUB_REPO }}
|
||||
platforms: "linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le,linux/s390x"
|
||||
platforms: "linux/amd64,linux/arm64"
|
||||
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Mirror + trigger CI
|
||||
|
||||
@@ -12,7 +12,7 @@ jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: JS-DevTools/npm-publish@v1
|
||||
with:
|
||||
token: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
@@ -30,16 +30,16 @@ jobs:
|
||||
# nodev: 12
|
||||
steps:
|
||||
- name: "Checkout codes"
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: "Use Node.js"
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "*"
|
||||
- name: "Pkg this"
|
||||
run: |
|
||||
npm run pkg "node${{ matrix.nodev }}-${{ matrix.platform }}-x64"
|
||||
- name: "Upload to artifact"
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: node${{ matrix.nodev }}-${{ matrix.platform }}-x64
|
||||
path: "dist/*.zip"
|
||||
@@ -62,14 +62,14 @@ jobs:
|
||||
- platform: alpine
|
||||
steps:
|
||||
- name: "Checkout codes"
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: "Pkg this"
|
||||
run: |
|
||||
npm run pkg "${{ matrix.platform }}-arm64"
|
||||
npm run pkg "node18-${{ matrix.platform }}-arm64"
|
||||
- name: "Upload to artifact"
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: arm64
|
||||
name: node18-${{ matrix.platform }}-arm64
|
||||
path: "dist/*.zip"
|
||||
- name: "Upload to release draft"
|
||||
uses: xresloader/upload-to-github-release@v1
|
||||
|
||||
@@ -1,5 +1,62 @@
|
||||
<!-- markdownlint-disable MD036 MD024-->
|
||||
# CHANGELOG
|
||||
## 主要变化(2.8.19)
|
||||
* d9f6bf2 feat: 中奖检测屏蔽自动回复 (#381)
|
||||
* ded981e fix: 动态卡片解析出错导致程序停止
|
||||
* 93d3727 fix: searcher.js typo fix (#379)
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.8.17)
|
||||
* 60e211e fix: 读取uid出错 (#369)
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.8.17)
|
||||
* 5b33ae3 fix: 读取uid出错 (#369)
|
||||
* 7e4650c feat: env可自定义UA (#371)
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.8.16)
|
||||
* 469a6dc fix: add getOneDynamicByDyid v1
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.8.15)
|
||||
* 7b6356a fix: 风控导致动态全为过时
|
||||
* d337fb2 fix: 查询动态详情的接口失效 (#349)
|
||||
* d9dba6f fix: Cannot read properties of null (reading 'is_liked')
|
||||
* eafa7c7 fix: Cannot read properties of null (reading 'length') (#360)
|
||||
* e2976cc docs: 文档更新cookie获取方式 (#357)
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.8.14)
|
||||
* f5bdd28 fix: update api getOneDynamicByDyid
|
||||
* cb6fad0 fix: get_dynamic_detail api (#351)
|
||||
* 780a3a9 fix: update get_dynamic_detail api (#350)
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.8.13)
|
||||
* addb9c6 fix: ghproxy.com->mirror.ghproxy.com (#333)
|
||||
* b86e756 fix: at错位
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.8.12)
|
||||
* 5d30178 ci: docker构建
|
||||
* 0c61070 fix: 评论并转发 (#259)
|
||||
* 6dfee7e fix: 出现帐号未登录错误时自动跳转下一个帐号
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.8.11)
|
||||
* 6496a8f fix: fs.close
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.8.10)
|
||||
* e32c3c9 fix: 已经关注用户未转发
|
||||
* 3bd77b3 fix: fs.close
|
||||
|
||||
@@ -64,6 +64,35 @@
|
||||
|
||||
#### 手动获取
|
||||
|
||||
第一种
|
||||
进入[B站主页](https://www.bilibili.com/)点击个人头像进入个人主页获取Cookie用于登录
|
||||
|
||||
Chrome浏览器:
|
||||
|
||||
进入个人主页后
|
||||
1. `F12`打开控制台
|
||||
|
||||
2. F5刷新
|
||||
|
||||
3. 根据图中找到network/网络 搜索nav,点击找到的nav,点标头,下滑,找到COOKIE全部复制
|
||||

|
||||
|
||||
注意!!!!!!!!!!!
|
||||
|
||||
注意!!!!!!!!!!!
|
||||
|
||||
注意!!!!!!!!!!!
|
||||
|
||||
所有网页端获取的COOKIE,每次打开网页端时,都会有概率刷新COOKIE,点击退出账号则会退出当前COOKIE。可以利用Chrome内核的浏览器创建多用户,专门用于获取COOKIE。
|
||||
|
||||
注意!!!!!!!!!!!
|
||||
|
||||
注意!!!!!!!!!!!
|
||||
|
||||
注意!!!!!!!!!!!
|
||||
|
||||
|
||||
第二种
|
||||
进入[B站主页](https://www.bilibili.com/)获取Cookie用于登录
|
||||
|
||||
Chrome浏览器:
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 127 KiB |
+4
-1
@@ -5,6 +5,7 @@ module.exports = Object.freeze({
|
||||
* - `NOTE` 帐号备注
|
||||
* - `NUMBER` 表示是第几个账号
|
||||
* - `CLEAR` 是否启用清理功能
|
||||
* - `ACCOUNT_UA` 账号UA, 可在浏览器控制台输入 navigator.userAgent 查看
|
||||
* ## 高级功能
|
||||
* - `ENABLE_CHAT_CAPTCHA_OCR` 开启评论验证码识别 使用方法见README
|
||||
* - `ENABLE_MULTIPLE_ACCOUNT` 是否启用多账号
|
||||
@@ -25,6 +26,7 @@ module.exports = Object.freeze({
|
||||
NOTE: "",
|
||||
NUMBER: 1,
|
||||
CLEAR: true,
|
||||
ACCOUNT_UA: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
|
||||
|
||||
ENABLE_CHAT_CAPTCHA_OCR: "",
|
||||
ENABLE_MULTIPLE_ACCOUNT: false,
|
||||
@@ -59,7 +61,8 @@ module.exports = Object.freeze({
|
||||
NOTE: "",
|
||||
NUMBER: 1,
|
||||
CLEAR: true,
|
||||
WAIT: 60 * 1000
|
||||
WAIT: 60 * 1000,
|
||||
ACCOUNT_UA: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
+15
-4
@@ -56,6 +56,9 @@ class Monitor extends Searcher {
|
||||
case 1001:
|
||||
event_bus.emit('Turn_off_the_Monitor', '评论失败')
|
||||
break;
|
||||
case 1010:
|
||||
event_bus.emit('Turn_off_the_Monitor', '已掉号')
|
||||
break;
|
||||
case 1004:
|
||||
event_bus.emit('Turn_off_the_Monitor', '需要输入验证码')
|
||||
break
|
||||
@@ -194,7 +197,6 @@ class Monitor extends Searcher {
|
||||
case 1007:
|
||||
case 1008:
|
||||
case 1009:
|
||||
case 1010:
|
||||
case 1011:
|
||||
case 2002:
|
||||
case 2003:
|
||||
@@ -217,6 +219,7 @@ class Monitor extends Searcher {
|
||||
is_outof_maxfollow = 2005
|
||||
break;
|
||||
case 1001:
|
||||
case 1010:
|
||||
case 1004:
|
||||
case 2001:
|
||||
case 3001:
|
||||
@@ -367,7 +370,7 @@ class Monitor extends Searcher {
|
||||
}
|
||||
|
||||
/* 超过指定时间退出 */
|
||||
if (now_ts - create_time > max_create_time * 86400) {
|
||||
if (create_time && now_ts - create_time > max_create_time * 86400) {
|
||||
log.info("筛选动态", `过时动态(https://t.bilibili.com/${dyid})`)
|
||||
return false
|
||||
}
|
||||
@@ -593,6 +596,10 @@ class Monitor extends Searcher {
|
||||
.replace(
|
||||
new RegExp(copy_chat[0], 'g'),
|
||||
global_var.get("myUNAME") || '')
|
||||
} else {
|
||||
if (is_repost_then_chat) {
|
||||
chat = chat + relay_chat
|
||||
}
|
||||
}
|
||||
|
||||
status = await retryfn(
|
||||
@@ -600,7 +607,7 @@ class Monitor extends Searcher {
|
||||
[4],
|
||||
() => bili.sendChatWithOcr(
|
||||
rid,
|
||||
is_repost_then_chat ? relay_chat.split('//')[0] : chat,
|
||||
chat,
|
||||
chat_type
|
||||
)
|
||||
)
|
||||
@@ -668,7 +675,11 @@ class Monitor extends Searcher {
|
||||
status = await retryfn(
|
||||
5,
|
||||
[3, 4],
|
||||
() => bili.autoRelay(global_var.get("myUID"), dyid, relay_chat, ctrl)
|
||||
() => bili.autoRelay(
|
||||
global_var.get("myUID"),
|
||||
dyid,
|
||||
relay_chat,
|
||||
ctrl)
|
||||
)
|
||||
|
||||
if (status) {
|
||||
|
||||
+102
-98
@@ -62,88 +62,33 @@ function parseDynamicCard(dynamic_detail_card) {
|
||||
const { strToJson } = utils;
|
||||
/**临时储存单个动态中的信息 */
|
||||
let obj = {};
|
||||
const { desc, card, extension, extend_json = "{}", display = {} } = dynamic_detail_card
|
||||
, { is_liked = 1, user_profile = {} } = desc
|
||||
, { info = {} } = user_profile
|
||||
, cardToJson = strToJson(card)
|
||||
, extendjsonToJson = strToJson(extend_json)
|
||||
, { add_on_card_info = [] } = display
|
||||
, { item } = cardToJson;
|
||||
const dy_type2chat_type = new Map([[1, 17], [2, 11], [4, 17], [8, 1], [64, 12]]);
|
||||
/* 转发者的UID */
|
||||
obj.uid = desc.uid
|
||||
/* 转发者的name */
|
||||
obj.uname = info.uname || ''
|
||||
/* 动态是否点过赞 */
|
||||
obj.is_liked = is_liked > 0
|
||||
/* 动态的ts10 */
|
||||
obj.create_time = desc.timestamp
|
||||
/* 动态类型 */
|
||||
obj.type = desc.type
|
||||
/* 用于发送评论 */
|
||||
obj.rid_str = desc.rid_str.length > 12 ? desc.dynamic_id_str : desc.rid_str;
|
||||
/* 用于发送评论 */
|
||||
obj.chat_type = dy_type2chat_type.get(obj.type) || 0;
|
||||
/* 转发者的动态ID !!!!此为大数需使用字符串值,不然JSON.parse()会有丢失精度 */
|
||||
obj.dynamic_id = desc.dynamic_id_str;
|
||||
/* 定位@信息 */
|
||||
obj.ctrl = (extendjsonToJson.ctrl) || [];
|
||||
/* 预约抽奖信息 */
|
||||
if (add_on_card_info.length > 0) {
|
||||
const [status, oid_str, text] = add_on_card_info
|
||||
.filter(it => typeof it.reserve_attach_card !== 'undefined'
|
||||
&& typeof it.reserve_attach_card.reserve_lottery !== 'undefined'
|
||||
&& typeof it.reserve_attach_card.reserve_button !== 'undefined')
|
||||
.map(({ reserve_attach_card }) => [
|
||||
reserve_attach_card.reserve_button.status,
|
||||
reserve_attach_card.oid_str,
|
||||
reserve_attach_card.reserve_lottery.text])[0] || [];
|
||||
if (status === 1) {
|
||||
obj.reserve_id = oid_str;
|
||||
obj.reserve_lottery_text = text;
|
||||
}
|
||||
}
|
||||
if (extendjsonToJson[""]) {
|
||||
let r = extendjsonToJson[""].reserve || {};
|
||||
let { reserve_id, reserve_lottery } = r;
|
||||
if (reserve_lottery === 1) {
|
||||
obj.reserve_id = reserve_id + "";
|
||||
obj.reserve_lottery_text = "信息丢失";
|
||||
}
|
||||
}
|
||||
if (extend_json.match(/"":\{"lottery/)) {
|
||||
obj.is_charge_lottery = true
|
||||
}
|
||||
/* 是否有官方抽奖 */
|
||||
obj.hasOfficialLottery = extension && extension.lott && true;
|
||||
/* 转发者的描述 纯文字内容 图片动态描述 后两个分别是视频动态的描述和视频本身的描述*/
|
||||
obj.description =
|
||||
(item && ((item.content || '') + (item.description || '')))
|
||||
|| (
|
||||
(cardToJson.dynamic || '')
|
||||
+ (cardToJson.desc || '')
|
||||
+ (cardToJson.vest && cardToJson.vest.content || '')
|
||||
)
|
||||
|| '';
|
||||
/* 转发 */
|
||||
if (obj.type === 1) {
|
||||
const { origin_extension, origin, origin_extend_json = "{}" } = cardToJson
|
||||
, originToJson = strToJson(origin)
|
||||
, { add_on_card_info = [] } = display.origin || {}
|
||||
, originExtendjsonToJson = strToJson(origin_extend_json)
|
||||
, { user, item } = originToJson;
|
||||
/* 源动态的ts10 */
|
||||
obj.origin_create_time = desc.origin.timestamp;
|
||||
/* 被转发者的UID */
|
||||
obj.origin_uid = desc.origin.uid;
|
||||
/* 源动态类型 */
|
||||
obj.origin_type = desc.orig_type
|
||||
/* 被转发者的rid(用于发评论) */
|
||||
obj.origin_rid_str = desc.origin.rid_str.length > 12 ? desc.origin.dynamic_id_str : desc.origin.rid_str;
|
||||
try {
|
||||
const { desc = {}, card = "{}", extension = {}, extend_json = "{}", display = {} } = dynamic_detail_card
|
||||
, { is_liked = 1, user_profile = {} } = desc || {}
|
||||
, { info = {} } = user_profile || {}
|
||||
, cardToJson = strToJson(card)
|
||||
, extendjsonToJson = strToJson(extend_json)
|
||||
, { add_on_card_info = [] } = display || {}
|
||||
, { item = {} } = cardToJson;
|
||||
const dy_type2chat_type = new Map([[1, 17], [2, 11], [4, 17], [8, 1], [64, 12]]);
|
||||
/* 转发者的UID */
|
||||
obj.uid = desc.uid
|
||||
/* 转发者的name */
|
||||
obj.uname = info.uname || ''
|
||||
/* 动态是否点过赞 */
|
||||
obj.is_liked = is_liked > 0
|
||||
/* 动态的ts10 */
|
||||
obj.create_time = desc.timestamp
|
||||
/* 动态类型 */
|
||||
obj.type = desc.type
|
||||
/* 用于发送评论 */
|
||||
obj.origin_chat_type = dy_type2chat_type.get(obj.origin_type) || 0
|
||||
/* 被转发者的动态的ID !!!!此为大数需使用字符串值,不然JSON.parse()会有丢失精度 */
|
||||
obj.origin_dynamic_id = desc.orig_dy_id_str;
|
||||
obj.rid_str = desc.rid_str.length > 12 ? desc.dynamic_id_str : desc.rid_str;
|
||||
/* 用于发送评论 */
|
||||
obj.chat_type = dy_type2chat_type.get(obj.type) || 0;
|
||||
/* 转发者的动态ID !!!!此为大数需使用字符串值,不然JSON.parse()会有丢失精度 */
|
||||
obj.dynamic_id = desc.dynamic_id_str;
|
||||
/* 定位@信息 */
|
||||
obj.ctrl = (extendjsonToJson.ctrl) || [];
|
||||
/* 预约抽奖信息 */
|
||||
if (add_on_card_info.length > 0) {
|
||||
const [status, oid_str, text] = add_on_card_info
|
||||
@@ -155,30 +100,89 @@ function parseDynamicCard(dynamic_detail_card) {
|
||||
reserve_attach_card.oid_str,
|
||||
reserve_attach_card.reserve_lottery.text])[0] || [];
|
||||
if (status === 1) {
|
||||
obj.origin_reserve_id = oid_str;
|
||||
obj.origin_reserve_lottery_text = text;
|
||||
obj.reserve_id = oid_str;
|
||||
obj.reserve_lottery_text = text;
|
||||
}
|
||||
}
|
||||
if (originExtendjsonToJson[""]) {
|
||||
let r = originExtendjsonToJson[""].reserve || {};
|
||||
if (extendjsonToJson[""]) {
|
||||
let r = extendjsonToJson[""].reserve || {};
|
||||
let { reserve_id, reserve_lottery } = r;
|
||||
if (reserve_lottery === 1) {
|
||||
obj.origin_reserve_id = reserve_id + "";
|
||||
obj.origin_reserve_lottery_text = "信息丢失";
|
||||
obj.reserve_id = reserve_id + "";
|
||||
obj.reserve_lottery_text = "信息丢失";
|
||||
}
|
||||
}
|
||||
if (origin_extend_json.match(/"":\{"lottery/)) {
|
||||
obj.origin_is_charge_lottery = true
|
||||
if (extend_json.match(/"":\{"lottery/)) {
|
||||
obj.is_charge_lottery = true
|
||||
}
|
||||
/* 是否有官方抽奖 */
|
||||
obj.origin_hasOfficialLottery = origin_extension && origin_extension.lott;
|
||||
/* 被转发者的name */
|
||||
obj.origin_uname = (user && (user.name || user.uname)) || '';
|
||||
/* 被转发者的描述 */
|
||||
obj.origin_description =
|
||||
(item && (item.content || '' + item.description || ''))
|
||||
|| (originToJson.dynamic || '' + originToJson.desc || '')
|
||||
obj.hasOfficialLottery = extension && extension.lott && true;
|
||||
/* 转发者的描述 纯文字内容 图片动态描述 后两个分别是视频动态的描述和视频本身的描述*/
|
||||
obj.description =
|
||||
(item && ((item.content || '') + (item.description || '')))
|
||||
|| (
|
||||
(cardToJson.dynamic || '')
|
||||
+ (cardToJson.desc || '')
|
||||
+ (cardToJson.vest && cardToJson.vest.content || '')
|
||||
)
|
||||
|| '';
|
||||
/* 转发 */
|
||||
if (obj.type === 1) {
|
||||
const { origin_extension = {}, origin = "{}", origin_extend_json = "{}" } = cardToJson
|
||||
, originToJson = strToJson(origin)
|
||||
, { add_on_card_info = [] } = display.origin || {}
|
||||
, originExtendjsonToJson = strToJson(origin_extend_json)
|
||||
, { user = {}, item = {} } = originToJson;
|
||||
/* 源动态的ts10 */
|
||||
obj.origin_create_time = desc.origin.timestamp;
|
||||
/* 被转发者的UID */
|
||||
obj.origin_uid = desc.origin.uid;
|
||||
/* 源动态类型 */
|
||||
obj.origin_type = desc.orig_type
|
||||
/* 被转发者的rid(用于发评论) */
|
||||
obj.origin_rid_str = desc.origin.rid_str.length > 12 ? desc.origin.dynamic_id_str : desc.origin.rid_str;
|
||||
/* 用于发送评论 */
|
||||
obj.origin_chat_type = dy_type2chat_type.get(obj.origin_type) || 0
|
||||
/* 被转发者的动态的ID !!!!此为大数需使用字符串值,不然JSON.parse()会有丢失精度 */
|
||||
obj.origin_dynamic_id = desc.orig_dy_id_str;
|
||||
/* 预约抽奖信息 */
|
||||
if (add_on_card_info.length > 0) {
|
||||
const [status, oid_str, text] = add_on_card_info
|
||||
.filter(it => typeof it.reserve_attach_card !== 'undefined'
|
||||
&& typeof it.reserve_attach_card.reserve_lottery !== 'undefined'
|
||||
&& typeof it.reserve_attach_card.reserve_button !== 'undefined')
|
||||
.map(({ reserve_attach_card }) => [
|
||||
reserve_attach_card.reserve_button.status,
|
||||
reserve_attach_card.oid_str,
|
||||
reserve_attach_card.reserve_lottery.text])[0] || [];
|
||||
if (status === 1) {
|
||||
obj.origin_reserve_id = oid_str;
|
||||
obj.origin_reserve_lottery_text = text;
|
||||
}
|
||||
}
|
||||
if (originExtendjsonToJson[""]) {
|
||||
let r = originExtendjsonToJson[""].reserve || {};
|
||||
let { reserve_id, reserve_lottery } = r;
|
||||
if (reserve_lottery === 1) {
|
||||
obj.origin_reserve_id = reserve_id + "";
|
||||
obj.origin_reserve_lottery_text = "信息丢失";
|
||||
}
|
||||
}
|
||||
if (origin_extend_json.match(/"":\{"lottery/)) {
|
||||
obj.origin_is_charge_lottery = true
|
||||
}
|
||||
/* 是否有官方抽奖 */
|
||||
obj.origin_hasOfficialLottery = origin_extension && origin_extension.lott;
|
||||
/* 被转发者的name */
|
||||
obj.origin_uname = (user && (user.name || user.uname)) || '';
|
||||
/* 被转发者的描述 */
|
||||
obj.origin_description =
|
||||
(item && (item.content || '' + item.description || ''))
|
||||
|| (originToJson.dynamic || '' + originToJson.desc || '')
|
||||
|| '';
|
||||
}
|
||||
} catch (e) {
|
||||
log.error("动态卡片解析", e)
|
||||
}
|
||||
|
||||
return obj
|
||||
@@ -192,14 +196,14 @@ function parseDynamicCard(dynamic_detail_card) {
|
||||
function modifyDynamicRes(res) {
|
||||
const
|
||||
{ data, code } = utils.strToJson(res),
|
||||
{ cards = [], has_more, offset } = data || {};
|
||||
{ cards, has_more, offset } = data || {};
|
||||
|
||||
if (code !== 0) {
|
||||
log.error('处理动态数据', '获取动态数据出错,可能是访问太频繁 \n' + res);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!cards.length) {
|
||||
if (cards == null || !cards || !cards.length) {
|
||||
log.warn('处理动态数据', '未找到任何动态信息')
|
||||
}
|
||||
|
||||
|
||||
+2
-7
@@ -5,12 +5,7 @@ module.exports = Object.freeze({
|
||||
DYNAMIC_REPOST_SHARE: 'https://api.vc.bilibili.com/dynamic_repost/v1/dynamic_repost/share',
|
||||
DYNAMIC_SVR_CREATE_DRAW: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/create_draw',
|
||||
DYNAMIC_SVR_CREATE: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/create',
|
||||
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V2: 'https://api.vc.bilibili.com/dynamic_svr/v2/dynamic_svr/get_dynamic_detail',
|
||||
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V3: 'https://api.vc.bilibili.com/dynamic_svr/v3/dynamic_svr/get_dynamic_detail',
|
||||
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V4: 'https://api.vc.bilibili.com/dynamic_svr/v4/dynamic_svr/get_dynamic_detail',
|
||||
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V5: 'https://api.vc.bilibili.com/dynamic_svr/v5/dynamic_svr/get_dynamic_detail',
|
||||
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V6: 'https://api.vc.bilibili.com/dynamic_svr/v6/dynamic_svr/get_dynamic_detail',
|
||||
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V7: 'https://api.vc.bilibili.com/dynamic_svr/v7/dynamic_svr/get_dynamic_detail',
|
||||
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V: 'https://api.vc.bilibili.com/dynamic_svr/v{{v}}/dynamic_svr/get_dynamic_detail',
|
||||
DYNAMIC_SVR_RM_DYNAMIC: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/rm_dynamic',
|
||||
DYNAMIC_SVR_SPACE_HISTORY: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/space_history',
|
||||
FEED_GET_ATTENTION_LIST: 'https://api.vc.bilibili.com/feed/v1/feed/get_attention_list',
|
||||
@@ -43,4 +38,4 @@ module.exports = Object.freeze({
|
||||
WEB_INTERFACE_CARD: 'https://api.bilibili.com/x/web-interface/card',
|
||||
WEB_INTERFACE_NAV_STAT: "https://api.bilibili.com/x/web-interface/nav/stat",
|
||||
WEB_INTERFACE_SEARCH_TYPE: 'https://api.bilibili.com/x/web-interface/search/type',
|
||||
})
|
||||
})
|
||||
|
||||
+40
-61
@@ -319,7 +319,7 @@ const bili_client = {
|
||||
const msgs = res.data.messages
|
||||
if (msgs instanceof Array) {
|
||||
log.info('私信细节', `${talker_id}有${size}条未读私信`)
|
||||
return msgs.map(it => it.content).join('\n')
|
||||
return msgs.filter(it => ![5, 8, 9, 10, 11].includes(it.msg_source)).map(it => it.content).join('\n')
|
||||
} else {
|
||||
log.warn('私信细节', `${talker_id}无私信`)
|
||||
}
|
||||
@@ -412,67 +412,46 @@ const bili_client = {
|
||||
return dyid
|
||||
})
|
||||
},
|
||||
_getOneDynamicByDyid: new Line('获取一个动态的细节', [
|
||||
(dynamic_id) => get({
|
||||
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V2,
|
||||
config: { retry: false },
|
||||
query: {
|
||||
dynamic_id
|
||||
}
|
||||
}),
|
||||
(dynamic_id) => get({
|
||||
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V3,
|
||||
config: { retry: false },
|
||||
query: {
|
||||
dynamic_id
|
||||
}
|
||||
}),
|
||||
(dynamic_id) => get({
|
||||
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V4,
|
||||
config: { retry: false },
|
||||
query: {
|
||||
dynamic_id
|
||||
}
|
||||
}),
|
||||
(dynamic_id) => get({
|
||||
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V5,
|
||||
config: { retry: false },
|
||||
query: {
|
||||
dynamic_id
|
||||
}
|
||||
}),
|
||||
(dynamic_id) => get({
|
||||
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V6,
|
||||
config: { retry: false },
|
||||
query: {
|
||||
dynamic_id
|
||||
}
|
||||
}),
|
||||
(dynamic_id) => get({
|
||||
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V7,
|
||||
config: { retry: false },
|
||||
query: {
|
||||
dynamic_id
|
||||
}
|
||||
}),
|
||||
], responseText => {
|
||||
const
|
||||
res = strToJson(responseText),
|
||||
{ code, data } = res,
|
||||
{ card } = data || {};
|
||||
switch (code) {
|
||||
case 0:
|
||||
if (card) {
|
||||
return [false, card, `ok`];
|
||||
} else {
|
||||
return [false, undefined, `动态不存在`];
|
||||
_getOneDynamicByDyid: new Line(
|
||||
'获取一个动态的细节',
|
||||
[
|
||||
(dynamic_id) => get({
|
||||
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V.replace('{{v}}', 1),
|
||||
config: { retry: false },
|
||||
query: {
|
||||
dynamic_id
|
||||
}
|
||||
case 500207:
|
||||
return [false, undefined, `该动态为包月充电专属可以给UP主充电后观看`];
|
||||
default:
|
||||
return [true, undefined, `获取动态数据出错:\n${responseText}`]
|
||||
}
|
||||
}),
|
||||
}),
|
||||
...Array(10)
|
||||
.fill(
|
||||
(dynamic_id) => get({
|
||||
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V.replace('{{v}}', Math.floor(Math.random() * 10 ** 10)),
|
||||
config: { retry: false },
|
||||
query: {
|
||||
dynamic_id
|
||||
}
|
||||
})
|
||||
)
|
||||
]
|
||||
, responseText => {
|
||||
const
|
||||
res = strToJson(responseText),
|
||||
{ code, data } = res,
|
||||
{ card } = data || {},
|
||||
{ desc } = card || {};
|
||||
switch (code) {
|
||||
case 0:
|
||||
if (card && desc) {
|
||||
return [false, card, `ok`];
|
||||
} else {
|
||||
return [false, undefined, `获取动态数据异常:\n${responseText}`];
|
||||
}
|
||||
case 500207:
|
||||
return [false, undefined, `该动态为包月充电专属可以给UP主充电后观看`];
|
||||
default:
|
||||
return [true, undefined, `获取动态数据出错:\n${responseText}`]
|
||||
}
|
||||
}),
|
||||
/**
|
||||
* 获取一个动态的细节
|
||||
* @param {string} dynamic_id
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ const DEFAULT_REDIRECT = false;
|
||||
/**错误尝试次数 */
|
||||
const DEFAULT_RETRY_TIMES = 6;
|
||||
/**Google Chrome */
|
||||
const DEFAULT_UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36';
|
||||
const DEFAULT_UA = process.env.ACCOUNT_UA || 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36';
|
||||
/**默认url编码 */
|
||||
const DEFAULT_CONTENT_TYPE = 'application/x-www-form-urlencoded; charset=UTF-8';
|
||||
/**
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ async function update(isDdownload) {
|
||||
if (download_url.length) {
|
||||
if (isDdownload) {
|
||||
await try_for_each(download_url.entries(), async ([i, url]) => {
|
||||
let proxy_url = "https://ghproxy.com/";
|
||||
let proxy_url = "https://mirror.ghproxy.com/";
|
||||
proxy_url += url
|
||||
log.warn('自动下载', `切换代理${proxy_url}`)
|
||||
await download(proxy_url, `latest_version${i}.zip`)
|
||||
|
||||
+2
-2
@@ -45,7 +45,7 @@ const utils = {
|
||||
const obj = JSON.parse(str);
|
||||
return typeof obj === 'object' ? obj : false
|
||||
} catch (e) {
|
||||
utils.log.error("json解析", e)
|
||||
utils.log.error("json解析", e + "\n" + params)
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -384,7 +384,7 @@ const utils = {
|
||||
rejects(err)
|
||||
} else {
|
||||
fs.write(fd, buffer, 0, buffer.length, 0, err => {
|
||||
fs.close()
|
||||
fs.close(fd)
|
||||
if (err) {
|
||||
rejects(err)
|
||||
} else {
|
||||
|
||||
@@ -37,6 +37,7 @@ async function main() {
|
||||
process.env.NUMBER = acco.NUMBER;
|
||||
process.env.CLEAR = acco.CLEAR;
|
||||
process.env.NOTE = acco.NOTE;
|
||||
process.env.ACCOUNT_UA = acco.ACCOUNT_UA;
|
||||
const err_msg = await main();
|
||||
if (err_msg) {
|
||||
return err_msg
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lottery-auto-script",
|
||||
"version": "2.8.10",
|
||||
"version": "2.8.19",
|
||||
"description": "自动参与B站动态抽奖",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
+2
-2
@@ -28,12 +28,12 @@ mkdir -p $TARGET_DIR
|
||||
npm install
|
||||
|
||||
if [[ "$1" == *"arm"* ]]; then
|
||||
OUTFILE="$TARGET_DIR/lottery-auto-script-node18-$1"
|
||||
OUTFILE="$TARGET_DIR/lottery-auto-script-$1"
|
||||
sudo podman run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
podman run -it \
|
||||
--rm \
|
||||
-v ${PWD}:/root/lottery \
|
||||
shanmite/pkg-arm64 -t "node18.5.0-$1" -o "$OUTFILE" .
|
||||
shanmite/pkg-arm64 -t "node18-$1" -o "$OUTFILE" .
|
||||
elif [[ "$1" == *"x64"* ]]; then
|
||||
OUTFILE="$TARGET_DIR/lottery-auto-script-$1"
|
||||
npx pkg -t "$1" -o "$OUTFILE" .
|
||||
|
||||
Reference in New Issue
Block a user