-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
1,222 additions
and
510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# iOS 6620 | ||
APP_KEY=27eb53fc9058f8c3 | ||
APP_SECRET=c2ed53a74eeefe3cf99fbd01d8c9c375 | ||
|
||
# Android | ||
#APP_KEY=1d8b6e7d45233436 | ||
#APP_SECRET=560c52ccd288fed045859ed18bffd973 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/vendor/ | ||
config |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Release Notes | ||
|
||
## v0.7.0 (2018-04-20) | ||
|
||
### Added | ||
- 项目重构,拥抱 composer | ||
- 全面更换客户端 API | ||
- 添加用户登录机制 ([#22](https://github.com/metowolf/BilibiliHelper/issues/22)) | ||
|
||
### Changed | ||
- Require PHP 5.4.0 or newer | ||
|
||
### Fixed | ||
- 修复宝箱验证码问题 ([#27](https://github.com/metowolf/BilibiliHelper/issues/27)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,160 @@ | ||
|
||
<p align="center"><img width="300px" src="https://i.loli.net/2018/04/20/5ad97bd395912.jpeg"></p> | ||
|
||
<p align="center"> | ||
<img src="https://img.shields.io/badge/version-0.7.0-green.svg?longCache=true&style=for-the-badge"> | ||
<img src="https://img.shields.io/badge/license-mit-blue.svg?longCache=true&style=for-the-badge"> | ||
</p> | ||
|
||
|
||
# BilibiliHelper | ||
B 站直播实用脚本 | ||
|
||
## 功能 | ||
- 每日签到 | ||
- 发送心跳包领经验 | ||
- 自动领限时礼物 | ||
- 自动领宝箱(瓜子) | ||
- 自动清理(投喂)过期礼物 | ||
## 功能组件 | ||
|
||
|plugin |version |description | | ||
|---------|---------|--------------| | ||
|Daily |18.04.19 |每日背包奖励 | | ||
|GiftSend |18.04.19 |自动清空过期礼物 | | ||
|Heart |18.04.19 |双端直播间心跳 | | ||
|Login |18.04.19 |帐号登录组件 | | ||
|SignIn |18.04.19 |每日签到 | | ||
|Silver |18.04.19 |自动领宝箱 | | ||
|Task |18.04.19 |每日任务 | | ||
|
||
## TODO | ||
- 抽小电视 | ||
|
||
## 更新日志 | ||
- 0.6.0: 更新大部分接口,新增参数自动检测 | ||
## 未完成功能 | ||
|待续| | ||
|-------| | ||
|节奏风暴| | ||
|抽小电视| | ||
|应援团签到| | ||
|
||
## 简易使用 | ||
1. 下载 `index.php`, `Bilibili.php` 两个文件,并放置在同一个目录下 | ||
2. 修改 `index.php`, 替换 cookie 为 B 站直播间的 cookie | ||
3. 键入命令 `php index.php`, 试运行(可选) | ||
4. 使用 `screen` 后台运行,或 `nohup` | ||
## 环境依赖 | ||
|Requirement| | ||
|-------| | ||
|PHP (>=5.6 or >=7.0)| | ||
|php-openssl| | ||
|php-curl| | ||
|
||
## 高级 | ||
用 systemd 食用最佳 | ||
在 `$api->callback=function(){}` 中可以添加自定义函数,实现 cookie 失效后的通知 | ||
通常使用 `composer` 工具会自动检测上述依赖问题。 | ||
|
||
* 项目 `composer.lock` 基于镜像生成 https://pkg.phpcomposer.com/ | ||
|
||
## 使用指南 | ||
|
||
1. 下载(克隆)项目代码,初始化项目 | ||
``` | ||
$ git clone https://github.com/metowolf/BilibiliHelper.git | ||
$ cd BilibiliHelper | ||
$ cp config.example config | ||
``` | ||
2. 使用 composer 工具进行安装。**如果不了解 composer 工具的使用,可以直接到 https://github.com/metowolf/BilibiliHelper/releases 下载完整代码包,解压后跳到第三步。** | ||
``` | ||
$ composer install | ||
``` | ||
3. 按照说明修改配置文件 `config`,只需填写帐号密码即可 | ||
4. 运行测试 | ||
``` | ||
$ php index.php | ||
``` | ||
|
||
PS: 这里推荐一个即时通知服务 https://sc.ftqq.com/3.version | ||
![](https://i.loli.net/2018/04/20/5ad986fa2c442.png) | ||
|
||
## 升级指南 | ||
1. 进入项目目录 | ||
``` | ||
$ cd BilibiliHelper | ||
``` | ||
2. 拉取最新代码 | ||
``` | ||
$ git pull | ||
``` | ||
3. 更新依赖库 | ||
``` | ||
$ composer install | ||
``` | ||
4. 如果使用 systemd 等,需要重启服务 | ||
``` | ||
$ systemctl restart bilibili | ||
``` | ||
|
||
## 部署指南 | ||
如果你将 BilibiliHelper 部署到线上服务器时,则需要配置一个进程监控器来监测 `php index.php` 命令,在它意外退出时自动重启。 | ||
|
||
通常可以使用以下的方式 | ||
- systemd (推荐) | ||
- Supervisor | ||
- screen | ||
- nohup | ||
|
||
## systemd 脚本 | ||
``` | ||
# /usr/lib/systemd/system/bilibili.service | ||
[Unit] | ||
Description=Bilibili Helper Daemon | ||
Documentation=https://i-meto.com/bilibili-silver/ | ||
Description=Bilibili Helper Manager | ||
Documentation=https://github.com/metowolf/BilibiliHelper | ||
After=network.target | ||
[Service] | ||
ExecStart=/usr/bin/php /path/to/index.php | ||
ExecStop=/bin/kill -HUP $MAINPID | ||
Restart=on-failure | ||
StartLimitInterval=30min | ||
StartLimitBurst=60 | ||
LimitNOFILE=65534 | ||
LimitNPROC=65534 | ||
LimitCORE=infinity | ||
ExecStart=/usr/bin/php /path/to/your/BilibiliHelper/index.php | ||
Restart=always | ||
[Install] | ||
WantedBy=multi-user.target | ||
``` | ||
|
||
## 注意事项 | ||
1. 虽然脚本为 PHP,但由于需要保持长时间运行,因此不能通过直接访问网页来使用 | ||
2. 需要额外安装 php-gd、php-curl 组件 | ||
## Supervisor 配置 | ||
``` | ||
[program:bilibili] | ||
process_name=%(program_name)s | ||
command=php /path/to/your/BilibiliHelper/index.php | ||
autostart=true | ||
autorestart=true | ||
redirect_stderr=true | ||
stdout_logfile=/tmp/bilibili.log | ||
``` | ||
|
||
## FAQ | ||
## 报错通知问题 | ||
脚本出现 error 级别的报错,会使用调用通知地址进行提醒,这里推荐两个服务 | ||
|
||
Q: 如何同时挂多个帐号? | ||
A: 可以复制 `index.php` 为 `index1.php`, 同样修改 cookie 后在 `crontab` 添加记录 | ||
|服务|官网| | ||
|---|---| | ||
|Server酱|https://sc.ftqq.com/| | ||
|TelegramBot|https://core.telegram.org/bots/api| | ||
|
||
Q: 为什么会有 `PHP Parse error: syntax error, unexpected '[' ` 报错? | ||
A: 这是因为 PHP 低版本不支持数组中括号写法,建议升级到 PHP5.6+,脚本现已兼容。 | ||
示范如下 | ||
``` | ||
# Server酱 | ||
# 自行替换 <SCKEY> | ||
APP_CALLBACK="https://sc.ftqq.com/<SCKEY>.send?text={message}" | ||
Q: 自动清理(投喂)过期礼物给谁? | ||
A: 默认投喂给我的直播间,如果需要的话,可以在 index.php 添加一行 | ||
# TelegramBot | ||
# 自行替换 <TOKEN> <CHAR_ID> | ||
APP_CALLBACK="http://api.telegram.org/<TOKEN>/sendMessage?chat_id=<CHAR_ID>&text={message}" | ||
``` | ||
$api->roomid='3746256'; // 主播房间号 | ||
|
||
`{message}` 部分会自动替换成错误信息,接口采用 get 方式发送 | ||
|
||
|
||
## 直播间 ID 问题 | ||
config 文件中有个 `ROOM_ID` 配置,填写此项可以清空临过期礼物给指定直播间。 | ||
|
||
通常可以在直播间页面的 url 获取到它 | ||
``` | ||
http://live.bilibili.com/3746256 | ||
``` | ||
|
||
所有直播间号码小于 1000 的直播间为短号,该脚本在每次启动会自动修正,无需关心, | ||
|
||
|
||
## License 许可证 | ||
|
||
本项目基于 MIT 协议发布,并增加了 SATA 协议。 | ||
|
||
当你使用了使用 SATA 的开源软件或文档的时候,在遵守基础许可证的前提下,你必须马不停蹄地给你所使用的开源项目 “点赞” ,比如在 GitHub 上 star,然后你必须感谢这个帮助了你的开源项目的作者,作者信息可以在许可证头部的版权声明部分找到。 | ||
|
||
Q: 更可靠的获取 cookie 方法? | ||
A: 需要点开一个直播间,按 F12 选 Network 选项卡,稍等大约 5 分钟后拿到 https://api.live.bilibili.com/ 开头的数据包,复制里面的 cookie 即可。 | ||
本项目的所有代码文件、配置项,除另有说明外,均基于上述介绍的协议发布,具体请看分支下的 LICENSE。 | ||
|
||
## License | ||
BilibiliHelper is under the MIT license. | ||
此处的文字仅用于说明,条款以 LICENSE 文件中的内容为准。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "metowolf/bilibili", | ||
"version": "0.7.0", | ||
"description": "B 站自动领瓜子、直播挂机脚本", | ||
"type": "project", | ||
"require": { | ||
"php": ">=5.4.0", | ||
"ext-curl": "*", | ||
"ext-openssl": "*", | ||
"vlucas/phpdotenv": "^2.4", | ||
"monolog/monolog": "^1.23", | ||
"bramus/monolog-colored-line-formatter": "^2.0" | ||
}, | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "metowolf", | ||
"email": "[email protected]", | ||
"homepage": "https://i-meto.com" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"metowolf\\Bilibili\\": "src/" | ||
} | ||
} | ||
} |
Oops, something went wrong.