Code Monkey home page Code Monkey logo

medalhelper's Issues

[Feat] Add config for cloud service

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

  • Aliyun
  • Tencent cloud

[BUG] Multi account execute error

Describe the bug

AB两个帐号,按要求写好配置文件,已检测无格式问题,运行后查看日志,会:

  1. 提示B帐号未登录
  2. A帐号执行完签到任务后,不会有其它任务的执行日志(检查b站那边,当天牌子经验也为0,说明确实没有执行)
  3. B帐号正确执行并显示日志

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,均能正常执行

[Feat] Wear medal before sending danmu

有的直播间开启了粉丝牌禁言,必须佩戴粉丝牌才能发言。
是否可以在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

[Feat] Docker cron improvement

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 ,无需改动配置文件,无需触碰定时的容器,且新容器运行完成后也会自动删除

[BUG] Doesn't work well on debian

$ ./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

[Feat] 每日任务,免费领电池

Describe the solution you'd like
每日发送5条弹幕可领1电池,可否增加一个功能选项,在检测到完成每日弹幕数量任务后自动领取?

docker build时出现问题

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

已经使用阿里镜像源

[BUG] 粉丝牌数超过200(不包括舰长)会导致每天最多300亲密度

粉丝牌数超过200(不包括舰长)会导致每天最多300亲密度。之前遇到过,删到200以下,过两天就恢复1500了。有解决办法吗?

image

Windows Binary (please complete the following information):

  • OS: Windows11
  • Version 1.4
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

[BUG] 当前佩戴的粉丝牌在每天第一次运行时读取不到

Describe the bug

设置的是每天零点之后的几分钟运行一次定时任务。当前佩戴的粉丝牌似乎不会去执行任务,日志里没有打印(其他直播间的任务都运行了)。但是手动再运行一次 start 命令就又可以正常运行。

To Reproduce

上文已经有写,就是固定佩戴一个粉丝牌,然后定时任务每天运行一次。任务结束后其他直播间的任务完成了,但这一个直播间的任务没有开始,因为一开始就没读取到这个牌子。
因为我是固定佩戴那一个粉丝牌,所以目前只观察到这一个直播间会这样。下次定时任务前我换个牌子看看。

Expected behavior

可以正常完成所有牌子的任务。

Screenshots

暂无。

Docker (please complete the following information):

  • Docker Version commit ID 100e94e.

Additional context

None

按照使用手册 docker run --rm -ti medalhelper login 报错

换了国外服务器拉起了镜像,执行登录时报错
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

[Feat] Send notification when running error

Is your feature request related to a problem? Please describe.
登录状态过期,当天任务未完成。事后发现断签,翻看运行日志才看到

[ERROR]用户登录失败, accessKey:

Describe the solution you'd like
在出现运行故障时也推送通知提醒

[BUG] 仅有心跳包正常,其他操作都失败

Describe the bug

如题,仅有观看时长的100亲密度成功,其他分享、弹幕等操作应该都失败了。

To Reproduce

正常cron运行。但是在运行的同时手机挂着一个直播间。

Expected behavior

任务能正常完成。

Screenshots

None

Docker (please complete the following information):

  • Docker Version 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] 分享完成

[Support] 可手动指定完成条件

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 的那个直播间今天是没开播的。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.