threecatslovefish / medalhelper Goto Github PK
View Code? Open in Web Editor NEW新版B站粉丝牌助手 Golang实现
License: GNU Affero General Public License v3.0
新版B站粉丝牌助手 Golang实现
License: GNU Affero General Public License v3.0
Is your feature request related to a problem? Please describe.
User may want to config this script on cloud service
Describe the solution you'd like
Detail doc and config in README file
TODO
Is your feature request related to a problem? Please describe.
no
Describe the solution you'd like
Support more push notifications, for example telegram
Describe alternatives you've considered
no
Additional context
https://core.telegram.org/bots/api#sendmessage
https://github.com/whyour/qinglong/blob/d43cee53c9cd4af752d50fd2c459de392c41eb38/sample/notify.js#L52
Describe the bug
AB两个帐号,按要求写好配置文件,已检测无格式问题,运行后查看日志,会:
Screenshots
2022/05/31 00:33:22 [INFO] 外部调用,开启任务
2022/05/31 00:33:23 A帐号 [INFO] 登录成功
2022/05/31 00:33:23 A帐号 [INFO] 今日已签到过,无法重复签到
2022/05/31 00:33:23 A帐号 [INFO] 当前用户UL等级: 还差 经验升级
2022/05/31 00:33:24 [ERROR]用户未登录, accessKey: xxxxxxxxxxxxxxxx(B帐号的key)
2022/05/31 00:33:24 B帐号 [INFO] 登录成功
2022/05/31 00:33:24 B帐号 [INFO] 今日已签到过,无法重复签到
2022/05/31 00:33:24 B帐号 [INFO] 当前用户UL等级:还差 经验升级
2022/05/31 00:33:25 B帐号 [INFO] xxxx 房间心跳包已发送(1/31)
……
Docker (please complete the following information):
Additional context
两个key均为有效状态,尝试单独注释帐号A或帐号B,均能正常执行
有的直播间开启了粉丝牌禁言,必须佩戴粉丝牌才能发言。
是否可以在user.yaml中添加一项:switchmedal_uid,让用户自己添加应该切换粉丝牌的直播间?
如果做不到切换粉丝牌,也可以设置为跳过这些直播间的发言打卡,同时判定该直播间亲密度>=1200时就结束。
不知道算不算Bug,也可能是因为我设置任务失败最多重试次数太高的原因:
当某个直播间开启了粉丝牌禁言,无法完成弹幕打卡时,程序会因为该直播间亲密度未>=1300而重复执行打卡程序,日志如下:
【1300及以上】 ....
【1200至1300】 [泛式 老番茄]等 2个
【1100至1200】 []等 0个
【1100以下】 []等 0个
2022/05/31 02:28:13 XXXXX [INFO] 老番茄 房间心跳包已发送(1/31)
2022/05/31 02:28:13 XXXXX [INFO] 泛式 房间心跳包已发送(1/31)
2022/05/31 02:28:25 XXXXX [INFO] 点赞完成
2022/05/31 02:28:43 XXXXX [INFO] 分享完成
2022/05/31 02:29:14 XXXXX [INFO] 泛式 房间心跳包已发送(2/31)
2022/05/31 02:29:14 XXXXX [INFO] 老番茄 房间心跳包已发送(2/31)
2022/05/31 02:30:14 XXXXX [INFO] 老番茄 房间心跳包已发送(3/31)
2022/05/31 02:30:14 XXXXX [INFO] 泛式 房间心跳包已发送(3/31)
2022/05/31 02:31:14 XXXXX [INFO] 泛式 房间心跳包已发送(4/31)
2022/05/31 02:31:14 XXXXX [INFO] 老番茄 房间心跳包已发送(4/31)
2022/05/31 02:32:11 XXXXX [INFO] 老番茄 房间弹幕打卡完成
2022/05/31 02:32:11 XXXXX [INFO] 弹幕打卡未完成,剩余(1/55)
2022/05/31 02:32:14 XXXXX [INFO] 泛式 房间心跳包已发送(5/31)
2022/05/31 02:32:14 XXXXX [INFO] 老番茄 房间心跳包已发送(5/31)
....
之后一直重复
平台:Windows10
使用Release v1.0 的可执行程序medal_win.exe
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Is your feature request related to a problem? Please describe.
有时(网络中断、设备断线、容器停止等)可能出现cron运行被错过、或运行不完整,为了完成当天的任务,需要手动重新运行。
但因为cron 是写在配置文件里面的,需要注释掉文件里cron的时间,再重启容器。等待重新执行完成后,还需要去掉文件里刚才注释的时间,再重启容器,否则会循环多次执行任务。
整个操作比较繁琐。
Describe the solution you'd like
改为使用 docker run 命令定义cron
docker run -d \
-e TZ=Asia/Shanghai \
-v $(pwd)/users.yaml:/config/users.yaml \
--restart unless-stopped \
--name medalhelper \
medalhelper
3 2 1 * *
若最后不添加cron,立即执行。添加cron,则按指定时间执行。
此时,若需要重新执行一次,则只需另开一个容器 docker run -d --rm -e TZ=Asia/Shanghai -v $(pwd)/users.yaml:/config/users.yaml --restart unless-stopped medalhelper
,无需改动配置文件,无需触碰定时的容器,且新容器运行完成后也会自动删除
$ ./medal_linux login
./medal_linux: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /medal_linux)
$ ldd --version
ldd (Debian GLIBC 2.33-8) 2.33
$ uname -a
Linux debian 5.18.0-3-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.14-1 (2022-07-23) x86_64 GNU/Linux
medal_linux is last version from github release
Describe the solution you'd like
每日发送5条弹幕可领1电池,可否增加一个功能选项,在检测到完成每日弹幕数量任务后自动领取?
Sending build context to Docker daemon 204.3kB
Step 1/9 : FROM golang:1 AS builder
---> 738636f06010
Step 2/9 : COPY . /app
---> Using cache
---> c096a859cb64
Step 3/9 : ARG CGO_ENABLED=0
---> Using cache
---> 7cdddda92991
Step 4/9 : ARG GOPROXY=https://goproxy.cn,direct
---> Using cache
---> fabc75acd53b
Step 5/9 : RUN cd /app && go build -o /medalhelper /app
---> Using cache
---> a5651ae57a93
Step 6/9 : FROM gcr.io/distroless/static
Get "https://gcr.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
在Docker Desktop中build依然拉取失败
failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to do request: Head "https://gcr.io/v2/distroless/static/manifests/latest": Service Unavailable
已经使用阿里镜像源
粉丝牌数超过200(不包括舰长)会导致每天最多300亲密度。之前遇到过,删到200以下,过两天就恢复1500了。有解决办法吗?
Windows Binary (please complete the following information):
USERS:
- access_key: # 注意冒号后的空格 否则会读取失败 英文冒号
allowed_uid: #123,666 # 白名单UID,填了后将覆盖配置只打卡,点赞,分享这些用户的勋章 用英文逗号分隔 不填则不限制
banned_uid: # 黑名单UID,填了后将不会打卡,点赞,分享 用英文逗号分隔 不填则不限制
push_name: # 推送服务,留空表示不需要推送
- access_key:
allowed_uid:
banned_uid:
push_name:
# 注意对齐
# 多用户以上格式添加
# 井号后为注释 井号前后必须有空格
DANMU:
[
"(⌒▽⌒).",
"( ̄▽ ̄).",
"(=・ω・=).",
"(`・ω・´).",
"(〜 ̄△ ̄)〜.",
"(・∀・).",
"(°∀°)ノ.",
"( ̄3 ̄).",
"╮( ̄▽ ̄)╭.",
"_(:3」∠)_.",
"(^・ω・^ ).",
"(● ̄(エ) ̄●).",
"ε=ε=(ノ≧∇≦)ノ.",
"⁄(⁄ ⁄•⁄ω⁄•⁄ ⁄)⁄.",
"←◡←.",
]
# 可在此处自定义打卡弹幕
CRON: #3 2 1 * *
# 这里是 cron 表达式, 从左到右参数为秒,分钟,小时,日期,月份
# Second | Minute | Hour | Dom | Month
# 例如每天凌晨01点02分03秒执行一次为 3 2 1 * *
# 如果不填,则不使用内置定时器,填写正确后要保持该进程一直运行
CD:
async: 1 # 异步执行,默认为1表示异步,0表示同步
retry: 1 # 任务失败重试时间,单位秒,设置为0不重试
max_try: 10 # 任务失败最多重试次数,单位次,设置为0不重试
like: 2 # 点赞间隔时间,单位秒,设置为0不点赞
share: 5 # 【已废弃】分享间隔时间,单位秒,设置为0不分享
danmu: 6 # 弹幕间隔时间,单位秒,设置为0不发送弹幕,只支持同步
PUSH:
- name: "PUSH_DEER_SAMPLE" # 推送名称,对应上面对应用户的推送,请保证名称唯一
token: "<YOUR-TOKEN-HERE>" # 推送服务TOKEN
type: "push_deer" # 推送服务类型为 PushDeer
url: "http://<pushdeer-url-or-ip>/message/push" # 推送服务URL
- name: "PUSH_PLUS_SAMPLE"
token: "<YOUR-TOKEN-HERE>"
type: "push_plus"
url: "http://www.pushplus.plus/send"
- name: "TELEGRAM_SAMPLE"
token: "<YOUR-TELEGRAM-CHATID>"
type: "telegram"
url: "https://api.telegram.org/bot<YOUR-BOT-TOKEN-HERE>/sendMessage"
# 推送服务,每日打卡成功或报错日志推送
# 目前支持PushDeer, PushPlus, Telegram
Describe the bug
设置的是每天零点之后的几分钟运行一次定时任务。当前佩戴的粉丝牌似乎不会去执行任务,日志里没有打印(其他直播间的任务都运行了)。但是手动再运行一次 start 命令就又可以正常运行。
To Reproduce
上文已经有写,就是固定佩戴一个粉丝牌,然后定时任务每天运行一次。任务结束后其他直播间的任务完成了,但这一个直播间的任务没有开始,因为一开始就没读取到这个牌子。
因为我是固定佩戴那一个粉丝牌,所以目前只观察到这一个直播间会这样。下次定时任务前我换个牌子看看。
Expected behavior
可以正常完成所有牌子的任务。
Screenshots
暂无。
Docker (please complete the following information):
Additional context
None
换了国外服务器拉起了镜像,执行登录时报错
docker run --rm -ti medalhelper login
panic: open users.yaml: no such file or directory
goroutine 1 [running]:
MedalHelper/util.InitConfig()
/app/util/config.go:49 +0x105
main.init.0()
/app/main.go:19 +0x2e
Is your feature request related to a problem? Please describe.
登录状态过期,当天任务未完成。事后发现断签,翻看运行日志才看到
[ERROR]用户登录失败, accessKey:
Describe the solution you'd like
在出现运行故障时也推送通知提醒
Describe the bug
如题,仅有观看时长的100亲密度成功,其他分享、弹幕等操作应该都失败了。
To Reproduce
正常cron运行。但是在运行的同时手机挂着一个直播间。
Expected behavior
任务能正常完成。
Screenshots
None
Docker (please complete the following information):
399e842
Additional context
一些日志
2022/06/16 00:32:47 [ERROR]Unmarshal BiliBaseResp error: unexpected end of JSON input, raw data: []
2022/06/16 00:32:47 [ERROR]ShareRoom error: Post error: <nil>, req: &{POST http://api.live.bilibili.com/xlive/app-room/v1/index/TrigerInteract HTTP/1.1 1 1 map[Accept:[application/json] Accept-Language:[en-US,en;q=0.5] Connection:[keep-alive] Content-Type:[application/x-www-form-urlencoded] User-Agent:[Mozilla/5.0 BiliDroid/6.73.1 ([email protected]) os/android model/Mi 10 Promobi_app/android build/6731100 channel/xiaomi innerVer/6731110 osVer/12 network/2]] {0xc00041a520} 0x646800 165 [] false api.live.bilibili.com map[] map[] <nil> map[] <nil> <nil> <nil> 0xc000018030}, data: map[access_key:KEY actionKey:appkey appkey:APPKEY interact_type:3 roomid:ROOM_ID sign:SIGN ts:TS]
2022/06/16 00:32:47 [ERROR]Unmarshal BiliBaseResp error: unexpected end of JSON input, raw data: []
2022/06/16 00:32:51 USER [INFO] ROOM 房间弹幕打卡完成
2022/06/16 00:32:51 [ERROR]GetFansMedalAndRoomID error: PostWithParam error: <nil>, req: &{POST http://api.live.bilibili.com/xlive/app-room/v1/dM/sendmsg?access_key=KEY&actionKey=appkey&appkey=APPKEY&sign=sign&ts=TS HTTP/1.1 1 1 map[Accept:[application/json] Accept-Language:[en-US,en;q=0.5] Connection:[keep-alive] Content-Type:[application/x-www-form-urlencoded] User-Agent:[Mozilla/5.0 BiliDroid/6.73.1 ([email protected]) os/android model/Mi 10 Promobi_app/android build/6731100 channel/xiaomi innerVer/6731110 osVer/12 network/2]]{0xc000228500}0x646800 89 [] false api.live.bilibili.com map[] map[] <nil> map[] <nil> <nil> <nil>0xc000018030}, data: map[cid:CID color:16777215 fontsize:25 msg:(⌒▽⌒). rnd:RND]
2022/06/16 00:32:51 [ERROR]Unmarshal BiliBaseResp error: unexpected end of JSON input, raw data: []
2022/06/16 00:32:52 USER [INFO] 分享完成
Is your feature request related to a problem? Please describe.
测试发现只有少数直播间(不特定,每次运行都是随机几个)可以打满 1300 亲密度。大部分直播间是只能打到 1200。具体是哪一个任务没做满我不太清楚。
但代码逻辑是不全部打到 1300 不会停止。是否有可能卡在上一次任务,然后错过下一次 CRON 运行。
Describe the solution you'd like
配置可以加一个开关,打满 1200 就算满了,不用继续尝试打到 1300。
Describe alternatives you've considered
No alternative yet.
Additional context
我是观察了一下,所有直播间挂了大约三轮心跳,其他分享、弹幕和点赞任务应该都是满了。可能是这个观看时长没生效。而且非常诡异的是打满 1300 的那个直播间今天是没开播的。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.