entry) {
110 | return new BasicNameValuePair(entry.getKey(), Optional.ofNullable(entry.getValue()).map(Object::toString).orElse(null));
111 | }
112 |
113 | public static NameValuePair[] getPairList(JsonObject pJson) {
114 | return pJson.entrySet().parallelStream().map(HttpUtil::getNameValuePair).toArray(NameValuePair[]::new);
115 | }
116 |
117 | public static JsonObject doGet(String url, JsonObject pJson) {
118 | // 通过址默认配置创建一个httpClient实例
119 | httpClient = HttpClients.createDefault();
120 | JsonObject resultJson = null;
121 | try {
122 | // 创建httpGet远程连接实例
123 | HttpGet httpGet = new HttpGet(url);
124 | // 设置请求头信息,鉴权
125 | httpGet.setHeader("Connection", "keep-alive");
126 | httpGet.setHeader("User-Agent", userAgent);
127 | httpGet.setHeader("Cookie", verify.getVerify());
128 | for (NameValuePair pair : getPairList(pJson)) {
129 | httpGet.setHeader(pair.getName(), pair.getValue());
130 | }
131 | // 为httpGet实例设置配置
132 | httpGet.setConfig(REQUEST_CONFIG);
133 | // 执行get请求得到返回对象
134 | httpResponse = httpClient.execute(httpGet);
135 | resultJson = processResult(httpResponse);
136 | } catch (Exception e) {
137 | e.printStackTrace();
138 | } finally {
139 | // 关闭资源
140 | httpResource(httpClient, httpResponse);
141 | }
142 | return resultJson;
143 |
144 | }
145 |
146 | public static JsonObject processResult(CloseableHttpResponse httpResponse) throws IOException {
147 | JsonObject resultJson = null;
148 | if (httpResponse != null) {
149 | int responseStatusCode = httpResponse.getStatusLine().getStatusCode();
150 | // 从响应对象中获取响应内容
151 | // 通过返回对象获取返回数据
152 | HttpEntity entity = httpResponse.getEntity();
153 | // 通过EntityUtils中的toString方法将结果转换为字符串
154 | String result = EntityUtils.toString(entity);
155 | resultJson = new JsonParser().parse(result).getAsJsonObject();
156 | switch (responseStatusCode) {
157 | case 200:
158 | break;
159 | case 412:
160 | log.debug("{}", httpResponse.getStatusLine());
161 | break;
162 | default:
163 | }
164 | }
165 | return resultJson;
166 | }
167 |
168 |
169 | private static void httpResource(CloseableHttpClient httpClient, CloseableHttpResponse response) {
170 | if (null != response) {
171 | try {
172 | response.close();
173 | } catch (IOException e) {
174 | e.printStackTrace();
175 | }
176 | }
177 | if (null != httpClient) {
178 | try {
179 | httpClient.close();
180 | } catch (IOException e) {
181 | e.printStackTrace();
182 | }
183 | }
184 | }
185 |
186 | public static void setUserAgent(String userAgent) {
187 | HttpUtil.userAgent = userAgent;
188 | }
189 | }
190 |
--------------------------------------------------------------------------------
/src/main/java/top/misec/task/GiveGift.java:
--------------------------------------------------------------------------------
1 | package top.misec.task;
2 |
3 | import com.google.gson.JsonArray;
4 | import com.google.gson.JsonObject;
5 | import lombok.extern.slf4j.Slf4j;
6 | import top.misec.config.Config;
7 | import top.misec.login.Verify;
8 | import top.misec.utils.HttpUtil;
9 |
10 | /**
11 | * B站直播送出即将过期的礼物
12 | *
13 | * @author srcrs
14 | * @Time 2020-10-13
15 | */
16 |
17 | @Slf4j
18 | public class GiveGift implements Task {
19 |
20 | private final String taskName = "B站直播送出即将过期的礼物";
21 | /**
22 | * 获取日志记录器对象
23 | */
24 | Config config = Config.getInstance();
25 |
26 | @Override
27 | public void run() {
28 | try {
29 | /* 从配置类中读取是否需要执行赠送礼物 */
30 | if (!config.isGiveGift()) {
31 | log.info("未开启自动送出即将过期礼物功能");
32 | return;
33 | }
34 | /* 直播间 id */
35 | String roomId = "";
36 | /* 直播间 uid 即 up 的 id*/
37 | String uid = "";
38 | /* B站后台时间戳为10位 */
39 | long nowTime = System.currentTimeMillis() / 1000;
40 | /* 获得礼物列表 */
41 | JsonArray jsonArray = xliveGiftBagList();
42 | /* 判断是否有过期礼物出现 */
43 | boolean flag = true;
44 | for (Object object : jsonArray) {
45 | JsonObject json = (JsonObject) object;
46 | long expireAt = Long.parseLong(json.get("expire_at").getAsString());
47 | /* 礼物还剩 1 天送出 */
48 | /* 永久礼物到期时间为 0 */
49 | if ((expireAt - nowTime) < 60 * 60 * 25 * 1 && expireAt != 0) {
50 | /* 如果有未送出的礼物,则获取一个直播间 */
51 | if ("".equals(roomId)) {
52 | JsonObject uidAndRid = getuidAndRid();
53 | uid = uidAndRid.get("uid").getAsString();
54 | roomId = uidAndRid.get("roomid").getAsString();
55 | }
56 |
57 | String requestBody = "biz_id=" + roomId +
58 | "&ruid=" + uid +
59 | "&bag_id=" + json.get("bag_id") +
60 | "&gift_id=" + json.get("gift_id") +
61 | "&gift_num=" + json.get("gift_num");
62 | JsonObject jsonObject3 = xliveBagSend(requestBody);
63 | if ("0".equals(jsonObject3.get("code").getAsString())) {
64 | /* 礼物的名字 */
65 | String giftName = jsonObject3.get("data").getAsJsonObject().get("gift_name").getAsString();
66 | /* 礼物的数量 */
67 | String giftNum = jsonObject3.get("data").getAsJsonObject().get("gift_num").getAsString();
68 | log.info("给直播间 - {} - {} - 数量: {}✔", roomId, giftName, giftNum);
69 | flag = false;
70 | } else {
71 | log.debug("送礼失败, 原因 : {}❌", jsonObject3);
72 | }
73 | }
74 | }
75 | if (flag) {
76 | log.info("当前无即将过期礼物❌");
77 | }
78 | } catch (Exception e) {
79 | log.error("💔赠送礼物异常 : ", e);
80 | }
81 | }
82 |
83 | /**
84 | * 获取一个直播间的room_id
85 | *
86 | * @return String
87 | * @author srcrs
88 | * @Time 2020-10-13
89 | */
90 | public String xliveGetRecommend() {
91 | return HttpUtil.doGet("https://api.live.bilibili.com/relation/v1/AppWeb/getRecommendList")
92 | .get("data").getAsJsonObject()
93 | .get("list").getAsJsonArray()
94 | .get(6).getAsJsonObject()
95 | .get("roomid").getAsString();
96 | }
97 |
98 | /**
99 | * B站获取直播间的uid
100 | *
101 | * @param roomId up 主的 uid
102 | * @return String
103 | * @author srcrs
104 | * @Time 2020-10-13
105 | */
106 | public String xliveGetRoomUid(String roomId) {
107 | JsonObject pJson = new JsonObject();
108 | pJson.addProperty("room_id", roomId);
109 | String urlPram = "?room_id=" + roomId;
110 | return HttpUtil.doGet("https://api.live.bilibili.com/xlive/web-room/v1/index/getInfoByRoom" + urlPram)
111 | .get("data").getAsJsonObject()
112 | .get("room_info").getAsJsonObject()
113 | .get("uid").getAsString();
114 | }
115 |
116 | /**
117 | * 根据 uid 获取其 roomid
118 | *
119 | * @param mid 即 uid
120 | * @return String 返回一个直播间id
121 | * @author srcrs
122 | * @Time 2020-11-20
123 | */
124 | public String getRoomInfoOld(String mid) {
125 | JsonObject pJson = new JsonObject();
126 | pJson.addProperty("mid", Integer.parseInt(mid));
127 | String urlPram = "?mid=" + mid;
128 | return HttpUtil.doGet("http://api.live.bilibili.com/room/v1/Room/getRoomInfoOld" + urlPram)
129 | .get("data").getAsJsonObject()
130 | .get("roomid").getAsString();
131 | }
132 |
133 | /**
134 | * B站直播获取背包礼物
135 | *
136 | * @return JsonArray
137 | * @author srcrs
138 | * @Time 2020-10-13
139 | */
140 | public JsonArray xliveGiftBagList() {
141 | return HttpUtil.doGet("https://api.live.bilibili.com/xlive/web-room/v1/gift/bag_list")
142 | .get("data").getAsJsonObject()
143 | .get("list").getAsJsonArray();
144 | }
145 |
146 | /**
147 | * B站直播送出背包的礼物
148 | *
149 | * @param requestBody
150 | * @return JsonObject
151 | * @author srcrs
152 | * @Time 2020-10-13
153 | */
154 | public JsonObject xliveBagSend(String requestBody) {
155 |
156 | requestBody += "&uid=" + Verify.getInstance().getUserId() +
157 | "&csrf=" + Verify.getInstance().getBiliJct() +
158 | "&send_ruid=" + "0" +
159 | "&storm_beat_id=" + "0" +
160 | "&price=" + "0" +
161 | "&platform=" + "pc" +
162 | "&biz_code=" + "live";
163 |
164 | return HttpUtil.doPost("https://api.live.bilibili.com/gift/v2/live/bag_send", requestBody);
165 | }
166 |
167 | /**
168 | * 获取一个包含 uid 和 RooId 的 json 对象
169 | *
170 | * @return JsonObject 返回一个包含 uid 和 RooId 的 json 对象
171 | * @author srcrs
172 | * @Time 2020-11-20
173 | */
174 | public JsonObject getuidAndRid() {
175 | /* 直播间 id */
176 | String roomId;
177 | /* 直播间 uid 即 up 的 id*/
178 | String uid;
179 | if (!config.getUpLive().equals("0")) {
180 | /* 获取指定up的id */
181 | uid = config.getUpLive();
182 | roomId = getRoomInfoOld(uid);
183 | String status = "0";
184 | if (status.equals(roomId)) {
185 | log.info("自定义up {} 无直播间", uid);
186 | /* 随机获取一个直播间 */
187 | roomId = xliveGetRecommend();
188 | uid = xliveGetRoomUid(roomId);
189 | log.info("随机直播间");
190 | } else {
191 | log.info("自定义up {} 的直播间", uid);
192 | }
193 |
194 | } else {
195 | /* 随机获取一个直播间 */
196 | roomId = xliveGetRecommend();
197 | uid = xliveGetRoomUid(roomId);
198 | log.info("随机直播间");
199 | }
200 | JsonObject json = new JsonObject();
201 | json.addProperty("uid", uid);
202 | json.addProperty("roomid", roomId);
203 | return json;
204 | }
205 |
206 | @Override
207 | public String getName() {
208 | return taskName;
209 | }
210 | }
211 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | BILIBILI-HELPER-PRE
4 |
5 |
6 | [](https://github.com/JunzhouLiu/BILIBILI-HELPER-PRE/stargazers)
7 | [](https://github.com/JunzhouLiu/BILIBILI-HELPER-PRE/network)
8 | [](https://github.com/JunzhouLiu/BILIBILI-HELPER-PRE/issues)
9 | [](https://github.com/JunzhouLiu/BILIBILI-HELPER-PRE/blob/main/LICENSE)
10 | [](https://github.com/JunzhouLiu/BILIBILI-HELPER-PRE/releases)
11 | [](https://hub.docker.com/r/superng6/bilibili-helper)
12 | [](https://github.com/JunzhouLiu/BILIBILI-HELPER-PRE/graphs/contributors)
13 | 
14 | [](https://app.fossa.com/projects/git%2Bgithub.com%2FJunzhouLiu%2FBILIBILI-HELPER?ref=badge_shield)
15 |
16 |
17 |
18 | ## 工具简介
19 |
20 | 原工具被 ban,目测是因为 GitHub actions,正在和 github 沟通,希望能够尽快恢复,本仓库版本移除了对 github actions 的支持。
21 |
22 | 这是一个利用 Linux Crontab , Docker 等方式实现哔哩哔哩(Bilibili)每日任务投币,点赞,分享视频,直播签到,银瓜子兑换硬币,漫画每日签到,简单配置即可每日轻松获取 65 经验值,快来和我一起成为
23 | Lv6 吧\~\~\~\~
24 |
25 | **如果觉得好用,顺手点个 Star 吧 ❤**
26 |
27 | **仓库地址:[JunzhouLiu/BILIBILI-HELPER-PRE](https://github.com/JunzhouLiu/BILIBILI-HELPER-PRE)**
28 |
29 | **B 站赛事预测助手已发布,每天自动参与 KPL,LPL 赛事预测,赚取硬币。**
30 |
31 | **仓库地址:[JunzhouLiu/bilibili-match-prediction](https://github.com/JunzhouLiu/bilibili-match-prediction)**
32 |
33 | **请不要滥用相关 API,让我们一起爱护 B 站 ❤**
34 |
35 |
36 |
37 | [也可点击此处一键加群](https://qm.qq.com/cgi-bin/qm/qr?k=m_M1Fydi3MvrVAEM0Sp6hDfZF4N2SpXU&jump_from=webapi)
38 |
39 | qq 群二维码
40 |
41 | 
42 |
43 |
44 |
45 | ## 功能列表
46 |
47 | - [x] 每天上午 9 点 10 分自动开始任务。_【运行时间可自定义】_
48 | - [x] 哔哩哔哩漫画每日自动签到,自动阅读 1 章节 。
49 | - [x] 每日自动从热门视频中随机观看 1 个视频,分享一个视频。
50 | - [x] 每日从热门视频中选取 5 个进行智能投币 _【如果投币不能获得经验了,则不会投币】_
51 | - [x] 投币支持下次一定啦,可自定义每日投币数量。_【如果检测到你已经投过币了,则不会投币】_
52 | - [x] 大会员月底使用快到期的 B 币券,给自己充电,一点也不会浪费哦,默认开启。_【已支持给指定 UP 充电】_
53 | - [x] 大会员月初 1 号自动领取每月 5 张 B 币券和福利。
54 | - [x] 每日哔哩哔哩直播自动签到,领取签到奖励。_【直播你可以不看,但是奖励咱们一定要领】_
55 | - [x] Linux 用户支持自定义配置了。
56 | - [x] 投币策略更新可配置投币喜好。_【可配置优先给关注的 up 投币】_
57 | - [x] 自动送出即将过期的礼物。 _【默认开启,未更新到新版本的用户默认关闭】_
58 | - [x] 支持推送执行结果到微信,钉钉,飞书等
59 |
60 | [点击快速开始使用](#使用说明)
61 |
62 | [点击快速查看自定义功能配置](#自定义功能配置)
63 |
64 | # 目录
65 |
66 | - [目录](#目录)
67 | - [使用说明](#使用说明)
68 | - [获取运行所需的 Cookies](#获取运行所需的-cookies)
69 | - [一、使用 腾讯云函数](#一使用-腾讯云函数)
70 | - [二、使用 Docker](#二使用-docker)
71 | - [三、使用 Linux Crontab 方式](#三使用-linux-crontab-方式)
72 | - [自定义功能配置](#自定义功能配置)
73 | - [订阅执行结果](#订阅执行结果)
74 | - [Server 酱 Turbo 版](#server-酱-turbo-版)
75 | - [Telegram 订阅执行结果](#telegram-订阅执行结果)
76 | - [钉钉机器人](#钉钉机器人)
77 | - [PushPlus(Push+)](#pushpluspush)
78 | - [更新和帮助](#更新和帮助)
79 | - [使用 Pull APP[推荐]](#使用-pull-app推荐)
80 | - [常见问题解答](#常见问题解答)
81 | - [免责声明](#免责声明)
82 | - [API 参考列表](#api-参考列表)
83 | - [基于本项目的衍生项目](#基于本项目的衍生项目)
84 | - [致谢](#致谢)
85 | - [License](#license)
86 | - [Stargazers over time](#stargazers-over-time)
87 |
88 | ## 使用说明
89 |
90 | ### 获取运行所需的 Cookies
91 |
92 | 1. **Fork 本项目**
93 | 2. **获取 Bilibili Cookies**
94 | 3. 浏览器打开并登录 [bilibili 网站]()
95 | 4. 按 F12 打开 「开发者工具」 找到 应用程序/Application -\> 存储 -\> Cookies
96 | 5. 找到 `bili_jct` `SESSDATA` `DEDEUSERID` 三项,并复制值,后面需要用到。
97 |
98 | 
99 |
100 | **请各位使用 Actions 时务必遵守 Github 条款。不要滥用 Actions 服务。**
101 |
102 | **Please be sure to abide by the Github terms when using Actions. Do not abuse the Actions service.**
103 |
104 | ### 一、使用 腾讯云函数
105 |
106 | 关于腾讯云 云函数功能开通相关问题 请加群询问。
107 |
108 | 腾讯云函数地址:[函数服务 - Serverless - 控制台 (tencent.com)](https://console.cloud.tencent.com/scf/list?rid=4&ns=default)
109 |
110 | 1.新建
111 |
112 | 
113 |
114 | 2.按照图示填写信息
115 |
116 | 执行方法:`top.misec.BiliMain::mainHandler`
117 |
118 | JAR包获取地址:[Release](https://github.com/JunzhouLiu/BILIBILI-HELPER-PRE/releases)
119 |
120 | 
121 |
122 | key:`scfFlag` value:`true`
123 |
124 | value配置文件:
125 |
126 | ```json
127 | {
128 | "numberOfCoins": 5,
129 | "reserveCoins": 50,
130 | "selectLike": 0,
131 | "monthEndAutoCharge": true,
132 | "giveGift": true,
133 | "upLive": "0",
134 | "chargeForLove": "0",
135 | "devicePlatform": "ios",
136 | "coinAddPriority": 1,
137 | "skipDailyTask": true,
138 | "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15",
139 | "dedeuserid": "",
140 | "sessdata": "",
141 | "biliJct": "",
142 | "telegrambottoken": null,
143 | "telegramchatid": null,
144 | "serverpushkey": null
145 | }
146 | ```
147 |
148 | **dedeuserid sessdata biliJct 必填**
149 |
150 | **不使用TG推送请把telegrambottoken和telegramchatid的值改为null(上面示例就是null)**
151 |
152 | **不推送请把serverpushkey值改为null(上面示例就是null)**
153 |
154 | 例子:
155 |
156 | ```json
157 | {
158 | "numberOfCoins": 5,
159 | "reserveCoins": 50,
160 | "selectLike": 0,
161 | "monthEndAutoCharge": true,
162 | "giveGift": true,
163 | "upLive": "0",
164 | "chargeForLove": "0",
165 | "devicePlatform": "ios",
166 | "coinAddPriority": 1,
167 | "skipDailyTask": true,
168 | "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15",
169 | "dedeuserid": "",
170 | "sessdata": "",
171 | "biliJct": "",
172 | "telegrambottoken": null,
173 | "telegramchatid": null,
174 | "serverpushkey": "https://oapi.dingtalk.com/robot/send?access_token=XXX"
175 | }
176 | ```
177 | SERVER酱:
178 | ```json
179 | {
180 | "numberOfCoins": 5,
181 | "reserveCoins": 50,
182 | "selectLike": 0,
183 | "monthEndAutoCharge": true,
184 | "giveGift": true,
185 | "upLive": "0",
186 | "chargeForLove": "0",
187 | "devicePlatform": "ios",
188 | "coinAddPriority": 1,
189 | "skipDailyTask": true,
190 | "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15",
191 | "dedeuserid": "",
192 | "sessdata": "",
193 | "biliJct": "",
194 | "telegrambottoken": null,
195 | "telegramchatid": null,
196 | "serverpushkey": "申请的KEY"
197 | }
198 | ```
199 |
200 | [具体推送配置请点这](#订阅执行结果)
201 |
202 | **日志配置 不需要像下边图里一样,直接默认就行**
203 |
204 | 
205 |
206 | 3.点完成后,再点击立即跳转
207 |
208 | 
209 |
210 | 4.创建个触发器
211 |
212 | 点 触发管理->创建触发器
213 |
214 | CRON表达式:`30 09 * * *`
215 |
216 | 
217 |
218 | 5.完成
219 |
220 | ### 二、使用 Docker
221 |
222 | 请自行参阅 [Issues/75#issuecomment-731705657][28] 和[基于本项目的衍生项目](#基于本项目的衍生项目)。
223 |
224 | [28]: https://github.com/JunzhouLiu/BILIBILI-HELPER/issues/75#issuecomment-731705657
225 |
226 | ### 三、使用 Linux Crontab 方式
227 |
228 | 1. 在 linux shell 环境执行以下命令,并按照提示输入 SESSDATA,DEDEUSERID,BILI_JCT,SCKEY 四个参数
229 |
230 | ```
231 | wget https://raw.githubusercontent.com/JunzhouLiu/BILIBILI-HELPER-PRE/main/setup.sh && chmod +x ./setup.sh && sudo ./setup.sh
232 | ```
233 |
234 | **ps:注意,如果使用自定义配置,请将`config.json`和 jar 包放置在同一目录(使用 setup.sh 安装则需要将`config.json`放置到`{HOME}/BILIBILI-HELPER`),`v1.2.2`
235 | 之后的版本`release`中都会携带一份`config.json`。**
236 |
237 | 2. 除此之外,也可以通过点击 [BILIBILI-HELPER-PRE/release][30],下载已发布的版本,解压后将 jar 包手动上传到 Linux 服务器,使用 crontab 完成定时执行,如果使用`crontab`
238 | 请记得`source /etc/profile`和`source ~/.bashrc`,建议直接使用仓库提供的[`start.sh`][31]脚本,注意修改脚本的 jar 包路径和 cookies 参数。
239 |
240 | [30]: https://github.com/JunzhouLiu/BILIBILI-HELPER-PRE/releases/latest
241 | [31]: https://github.com/JunzhouLiu/BILIBILI-HELPER-PRE/blob/main/start.sh
242 |
243 | **crontab 命令示例**
244 |
245 | `30 10 * * * sh /home/start.sh`
246 |
247 | | args | 说明 |
248 | | ----------------- | ------------------ |
249 | | 30 10 \* \* \* | `crontab` 定时时间 |
250 | | sh /home/start.sh | `start.sh`的路径 |
251 |
252 | ```shell
253 | #!/bin/bash
254 | source /etc/profile
255 | source ~/.bashrc
256 | source ~/.zshrc #其他终端请自行引入环境变量
257 | echo $PATH
258 | java -jar /home/BILIBILI-HELPER.jar DEDEUSERID SESSDATA BILI_JCT SCKEY >> /var/log/bilibili-help.log
259 | # 注意将jar包路径替换为实际路径。将参数修改该你自己的参数,cookies中含有等特殊字符需要转义。
260 | ```
261 |
262 | **命令示例:**
263 |
264 | ```shell
265 | # *如果Cookies参数中包含特殊字符,例如`%`请使用`\`转义*,如果不执行可在命令前增加 source /etc/profile
266 | # m h dom mon dow command
267 | 30 10 * * * java -jar /home/BILIBILI-HELP.jar DEDEUSERID SESSDATA BILI_JCT >/var/log/cron.log &
268 | ```
269 |
270 | ### 自定义功能配置
271 |
272 | 配置文件示例:
273 |
274 | ```json
275 | {
276 | "numberOfCoins": 5,
277 | "reserveCoins": 50,
278 | "selectLike": 0,
279 | "monthEndAutoCharge": true,
280 | "giveGift": true,
281 | "upLive": "0",
282 | "chargeForLove": "0",
283 | "devicePlatform": "ios",
284 | "coinAddPriority": 1,
285 | "skipDailyTask": true,
286 | "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15"
287 | }
288 | ```
289 |
290 | **Windows/Linux 用户使用 jar 包时,`release`包中会包含一份`config.json`配置文件,只需将其和`BILIBILI-HELP.jar`放在同一目录即可,执行时优先加载外部配置文件**
291 |
292 | 配置文件参数示意
293 |
294 | | Key | Value | 说明 |
295 | | ------------------ | -------------------- | ------------------------------------------------------------------------ |
296 | | numberOfCoins | [0,5] | 每日投币数量,默认 5 ,为 0 时则不投币 |
297 | | reserveCoins | [0,4000] | 预留的硬币数,当硬币余额小于这个值时,不会进行投币任务,默认值为 50 |
298 | | selectLike | [0,1] | 投币时是否点赞,默认 0, 0:否 1:是 |
299 | | monthEndAutoCharge | [false,true] | 年度大会员月底是否用 B 币券给自己充电,默认 `true`,即充电对象是你本人。 |
300 | | giveGift | [false,true] | 直播送出即将过期的礼物,默认开启,如需关闭请改为 false |
301 | | upLive | [0,送礼 up 主的 uid] | 直播送出即将过期的礼物,指定 up 主,为 0 时则随随机选取一个 up 主 |
302 | | chargeForLove | [0,充电对象的 uid] | 给指定 up 主充电,值为 0 或者充电对象的 uid,默认为 0,即给自己充电。 |
303 | | devicePlatform | [ios,android] | 手机端漫画签到时的平台,建议选择你设备的平台 ,默认 `ios` |
304 | | coinAddPriority | [0,1] | 0:优先给热榜视频投币,1:优先给关注的 up 投币 |
305 | | userAgent | 浏览器 UA | 用户可根据部署平台配置,可根据 userAgent 参数列表自由选取 |
306 | | skipDailyTask | [false,true] | 是否跳过每日任务,默认`true`,如果关闭跳过每日任务,请改为`false` |
307 |
308 | **tips:如果你没有上传过视频并开启充电计划,充电会失败,B 币券会浪费。此时建议配置为给指定的 up 主充电。欢迎给即将秃头的我充电 uid:[14602398][32] **
309 |
310 | [32]: https://space.bilibili.com/14602398
311 |
312 | userAgent 可选参数列表
313 |
314 | | 平台 | 浏览器 | userAgent |
315 | | --------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
316 | | Windows10 | EDGE(chromium) | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36 Edg/86.0.622.69 |
317 | | Windows10 | Chrome | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36 |
318 | | masOS | safari | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15 |
319 | | macOS | Firefox | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:65.0) Gecko/20100101 Firefox/65.0 |
320 | | macOS | Chrome | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36 |
321 |
322 | _ps:如果尝试给关注的 up 投币十次后(保不准你关注的是年更 up 主),还没完成每日投币任务,则切换成热榜模式,给热榜视频投币_
323 |
324 | _投币数量代码做了处理,如果本日投币不能获得经验了,则不会投币,每天只投能获得经验的硬币。假设你设置每日投币 3 个,早上 7 点你自己投了 2 个硬币,则十点半时,程序只会投 1 个)_
325 | tips:从1.4.1版本开始,随机视频投币有一定的概率会将硬币投给本项目的核心开发者,算是对核心开发者长期以来维护的回馈。
326 | ## 订阅执行结果
327 |
328 | ### Server 酱 Turbo 版
329 |
330 | 目前 Turbo 版本的消息通道支持以下渠道
331 |
332 | - 企业微信应用消息
333 | - Android,
334 | - Bark iOS,
335 | - 企业微信群机器人
336 | - 钉钉群机器人
337 | - 飞书群机器人
338 | - 自定义微信测试号
339 | - 方糖服务号
340 |
341 | 1. 前往 [sct.ftqq.com](https://sct.ftqq.com/sendkey)点击登入,创建账号。
342 | 2. 点击点[SendKey](https://sct.ftqq.com/sendkey) ,生成一个 Key。将其增加到 Github Secrets 中,变量名为 `SERVERPUSHKEY`
343 | 3. [配置消息通道](https://sct.ftqq.com/forward) ,选择方糖服务号,保存即可。
344 | 4. 推送效果展示
345 | 
346 |
347 | **
348 | 旧版推送渠道[sc.ftqq.com](http://sc.ftqq.com/9.version0) 即将与 4 月底下线,请前往[sct.ftqq.com](https://sct.ftqq.com/sendkey)生成`Turbo`版本的`Key`,注意,申请 Turbo 版 Key 后请配置消息通道,如果想沿用以前的推送方式,选择方糖服务号即可**
349 |
350 | ### Telegram 订阅执行结果
351 |
352 | 1.在 Telegram 中添加 BotFather 这个账号,然后依次发送/start /newbot 按照提示即可创建一个新的机器人。记下来给你生成的 token。
353 |
354 | 2.搜索刚刚创建的机器人的名字,并给它发送一条消息。
355 |
356 | _特别注意:需要先与机器人之间创建会话,机器人才能下发消息,否则机器人无法主动发送消息,切记!_
357 |
358 | 3.在 Telegram 中搜索 userinfobot,并给它发送一条消息,它会返回给你 chatid。
359 |
360 | 4.在 Github Secrets 中删除 SERVERPUSHKEY,添加 TELEGRAMBOTTOKEN,TELEGRAMCHATID。
361 |
362 | ### 钉钉机器人
363 |
364 | 1.首先你得有个钉钉企业 [快速注册](https://oa.dingtalk.com/register.html)
365 |
366 | 2.[进入钉钉开放平台添加机器人](https://open-dev.dingtalk.com/#/corprobot)
367 |
368 | 3.添加自定义关键词:BILIBILI
369 |
370 | 4.在 Github Secrets 中的 SERVERPUSHKEY 中更新成机器人的 Webhook
371 |
372 | 例如:`https://oapi.dingtalk.com/robot/send?access_token=XXX`
373 |
374 | 5.完成
375 |
376 | ### PushPlus(Push+)
377 |
378 | 1.[前往 PushPlus 获取 Token](https://www.pushplus.plus/push1.html)
379 |
380 | 2.在 Github Secrets 中的 SERVERPUSHKEY 中更新成获取到的 Token
381 |
382 | 3.完成
383 |
384 | ## 更新和帮助
385 |
386 | ### 使用 Pull APP[推荐]
387 |
388 | 参阅 [Pull APP](https://github.com/apps/pull)
389 |
390 | ### 常见问题解答
391 |
392 | ## 免责声明
393 |
394 | 1. 本工具不会记录你的任何敏感信息,也不会上传到任何服务器上。(例如用户的 cookies 数据,cookies 数据均存在 Actions Secrets 中或者用户自己的设备上)
395 | 2. 本工具不会记录任何执行过程中来自 b 站的数据信息,也不会上传到任何服务器上。(例如 av 号,bv 号,用户 uid 等)。
396 | 3. 本工具执行过程中产生的日志,仅会在使用者自行配置推送渠道后进行推送。日志中不包含任何用户敏感信息。
397 | 4. 如果有人修改了本项目(或者直接使用本项目)盈利恰饭,那和我肯定没关系,我开源的目的单纯是技术分享。
398 | 5. 如果你使用了第三方修改的,打包的本工具代码,那你可得注意了,指不定人就把你的数据上传到他自己的服务器了,这可和我没关系。(**网络安全教育普及任重而道远**)
399 | 6. 本工具源码仅在[JunzhouLiu/BILIBILI-HELPER-PRE](https://github.com/JunzhouLiu/BILIBILI-HELPER-PRE)开源,其余的地方的代码均不是我提交的,可能是抄我的,借鉴我的,但绝对不是我发布的,出问题和我也没关系。
400 | 7. 我开源本工具的代码仅仅是技术分享,没有任何丝毫的盈利赚钱目的,如果你非要给我打赏/充电,那我就是网络乞丐,咱们不构成任何雇佣,购买关系的交易。
401 | 8. 本项目不会增加类似于自动转发抽奖,秒杀,下载版权受限视频等侵犯 UP 主/B 站权益的功能,开发这个应用的目的是单纯的技术分享。下游分支开发者/使用者也请不要滥用相关功能。
402 | 9. 本项目欢迎其他开发者参与贡献,基于本工具的二次开发,使用其他语言重写都没有什么问题,能在技术上给你带来帮助和收获就很好.
403 | 10. 本项目遵守[MIT License](https://github.com/JunzhouLiu/BILIBILI-HELPER-PRE/blob/main/LICENSE),请各位知悉。
404 |
405 | ## API 参考列表
406 |
407 | - [SocialSisterYi/bilibili-API-collect](https://github.com/SocialSisterYi/bilibili-API-collect)
408 | - [happy888888/BiliExp](https://github.com/happy888888/BiliExp)
409 |
410 | ## 基于本项目的衍生项目
411 |
412 | - **基于本项目的 docker 封装项目:[SuperNG6/docker-bilibili-helper](https://github.com/SuperNG6/docker-bilibili-helper)**
413 |
414 | - **基于本项目的 docker 镜像:[superng6/bilibili-helper](https://hub.docker.com/r/superng6/bilibili-helper)**
415 |
416 | - **基于本项目的 runer 项目:[KurenaiRyu/bilibili-helper-runer](https://github.com/KurenaiRyu/bilibili-helper-runer)**
417 |
418 | - **基于本项目的 k8s 项目:[yangyang0507/k8s-bilibili-helper](https://github.com/yangyang0507/k8s-bilibili-helper)**
419 |
420 | ## 致谢
421 |
422 | 感谢 JetBrains 对本项目的支持。
423 |
424 | [](https://www.jetbrains.com/?from=BILIBILI-HELPER)
425 |
426 | ## License
427 |
428 | [](https://app.fossa.com/projects/git%2Bgithub.com%2FJunzhouLiu%2FBILIBILI-HELPER?ref=badge_large)
429 |
430 | ## Stargazers over time
431 |
432 | [](https://starchart.cc/JunzhouLiu/BILIBILI-HELPER-PRE)
433 |
--------------------------------------------------------------------------------