mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-19 09:30:10 +08:00
Merge branch 'lkeme:master' into master
This commit is contained in:
commit
196145e469
2
.gitignore
vendored
2
.gitignore
vendored
@ -14,6 +14,7 @@ tmp/
|
|||||||
out
|
out
|
||||||
gen
|
gen
|
||||||
/vendor/
|
/vendor/
|
||||||
|
composer.lock
|
||||||
/configs/
|
/configs/
|
||||||
/tests/
|
/tests/
|
||||||
config
|
config
|
||||||
@ -28,6 +29,7 @@ conf/user1.ini
|
|||||||
/conf/test1.ini
|
/conf/test1.ini
|
||||||
/src/backup/
|
/src/backup/
|
||||||
script.php
|
script.php
|
||||||
|
ABOUT.md
|
||||||
|
|
||||||
task/*
|
task/*
|
||||||
cache/*
|
cache/*
|
||||||
|
|||||||
2621
composer.lock
generated
2621
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -180,8 +180,9 @@ filter_words =
|
|||||||
[notify.dingtalk]
|
[notify.dingtalk]
|
||||||
token =
|
token =
|
||||||
|
|
||||||
; Tele机器人|token|chatid|依赖USE_NOTIFY
|
; Tele机器人|url(可选)|token|chatid|依赖USE_NOTIFY
|
||||||
[notify.telegram]
|
[notify.telegram]
|
||||||
|
url =
|
||||||
bottoken =
|
bottoken =
|
||||||
chatid =
|
chatid =
|
||||||
|
|
||||||
|
|||||||
@ -5,9 +5,9 @@
|
|||||||
"data": [
|
"data": [
|
||||||
{
|
{
|
||||||
"_url": "注释: 活动地址",
|
"_url": "注释: 活动地址",
|
||||||
"url": "https://www.bilibili.com/blackboard/activity-kiOl0D1nF8.html",
|
"url": "https://www.bilibili.com/blackboard/genshin-1st-anniversary.html",
|
||||||
"_title": "注释: 活动标题",
|
"_title": "注释: 活动标题",
|
||||||
"title": "原神2.0版本UP主激励计划",
|
"title": "原神一周年庆典UP主激励计划",
|
||||||
"_description": "注释: 活动描述",
|
"_description": "注释: 活动描述",
|
||||||
"description": "每日在原神分区任意直播间观看,20分钟1张、1小时2张、2小时3张,每日最高6张。",
|
"description": "每日在原神分区任意直播间观看,20分钟1张、1小时2张、2小时3张,每日最高6张。",
|
||||||
"_room_id": "注释: 活动直播间,如果为0,则取分区随机一个",
|
"_room_id": "注释: 活动直播间,如果为0,则取分区随机一个",
|
||||||
@ -17,15 +17,27 @@
|
|||||||
"_parent_area_id": "注释: 主分区id",
|
"_parent_area_id": "注释: 主分区id",
|
||||||
"parent_area_id": 3,
|
"parent_area_id": 3,
|
||||||
"_coin_id": "注释: 抽奖id",
|
"_coin_id": "注释: 抽奖id",
|
||||||
"coin_id": 209,
|
"coin_id": 249,
|
||||||
"_pool_id": "注释: 抽奖id",
|
"_pool_id": "注释: 抽奖id",
|
||||||
"pool_id": 219,
|
"pool_id": 257,
|
||||||
"_watch_time": "注释: 观看时长 单位秒",
|
"_watch_time": "注释: 观看时长 单位秒",
|
||||||
"watch_time": 7320,
|
"watch_time": 7320,
|
||||||
"_draw_times": "注释: 抽奖次数",
|
"_draw_times": "注释: 抽奖次数",
|
||||||
"draw_times": 6,
|
"draw_times": 6,
|
||||||
"_expire_at": "注释: 活动有效时间",
|
"_expire_at": "注释: 活动有效时间",
|
||||||
"expire_at": "2021-08-31 23:59:59"
|
"expire_at": "2021-10-12 23:59:59"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://live.bilibili.com/6",
|
||||||
|
"title": "S11,LOL,英雄联盟,全球总决赛",
|
||||||
|
"description": "每日在LOL直播间观看,1分钟1张,3分钟2张,5分钟3张",
|
||||||
|
"room_id": 0,
|
||||||
|
"area_id": 86,
|
||||||
|
"parent_area_id": 2,
|
||||||
|
"coin_id": 76,
|
||||||
|
"watch_time": 600,
|
||||||
|
"draw_times": 0,
|
||||||
|
"expire_at": "2021-11-06 23:59:59"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url": "https://www.bilibili.com/blackboard/activity-aCrSakaiX5.html",
|
"url": "https://www.bilibili.com/blackboard/activity-aCrSakaiX5.html",
|
||||||
@ -156,18 +168,6 @@
|
|||||||
"watch_time": 1000,
|
"watch_time": 1000,
|
||||||
"draw_times": 2,
|
"draw_times": 2,
|
||||||
"expire_at": "2021-08-29 23:59:59"
|
"expire_at": "2021-08-29 23:59:59"
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "https://live.bilibili.com/6",
|
|
||||||
"title": "2021LPL春季赛",
|
|
||||||
"description": "每日在LOL直播间观看,5分钟1张,15分钟1张",
|
|
||||||
"room_id": 7734200,
|
|
||||||
"area_id": 86,
|
|
||||||
"parent_area_id": 2,
|
|
||||||
"coin_id": 76,
|
|
||||||
"watch_time": 3720,
|
|
||||||
"draw_times": 3,
|
|
||||||
"expire_at": "2021-05-31 23:59:59"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -23,22 +23,33 @@ class Device
|
|||||||
private string $bili_file = 'bili.yaml';
|
private string $bili_file = 'bili.yaml';
|
||||||
private string $device_file = 'device.yaml';
|
private string $device_file = 'device.yaml';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载配置
|
* @use 真实路径
|
||||||
|
* @param string $file
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function fileRealPath(string $file): string
|
||||||
|
{
|
||||||
|
return APP_CONF_PATH . $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @use 加载配置
|
||||||
*/
|
*/
|
||||||
public function load(string $load_file)
|
public function load(string $load_file)
|
||||||
{
|
{
|
||||||
// 提前处理 后缀
|
// 提前处理 后缀
|
||||||
$custom_file = str_replace(strrchr($load_file, "."), "", $load_file) . '_';
|
$custom_file = str_replace(strrchr($load_file, "."), "", $load_file) . '_';
|
||||||
// 自定义客户端
|
// 自定义客户端
|
||||||
if (is_file(APP_CONF_PATH . $custom_file . $this->bili_file)) {
|
if (is_file($this->fileRealPath($custom_file . $this->bili_file))) {
|
||||||
$this->bili_file = APP_CONF_PATH . $custom_file . $this->bili_file;
|
$this->bili_file = $custom_file . $this->bili_file;
|
||||||
Log::info('使用自定义Bili.yaml');
|
Log::info('使用自定义' . $this->bili_file);
|
||||||
}
|
}
|
||||||
// 自定义设备
|
// 自定义设备
|
||||||
if (is_file(APP_CONF_PATH . $custom_file . $this->device_file)) {
|
if (is_file($this->fileRealPath($custom_file . $this->device_file))) {
|
||||||
$this->device_file = APP_CONF_PATH . $custom_file . $this->device_file;
|
$this->device_file = $custom_file . $this->device_file;
|
||||||
Log::info('使用自定义Device.yaml');
|
Log::info('使用自定义' . $this->device_file);
|
||||||
}
|
}
|
||||||
// 加载数据
|
// 加载数据
|
||||||
$this->device = new Config();
|
$this->device = new Config();
|
||||||
@ -47,7 +58,7 @@ class Device
|
|||||||
$files = [$this->bili_file, $this->device_file];
|
$files = [$this->bili_file, $this->device_file];
|
||||||
// 循环加载
|
// 循环加载
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
$processor->extend($loader->load(APP_CONF_PATH . $file));
|
$processor->extend($loader->load($this->fileRealPath($file)));
|
||||||
}
|
}
|
||||||
$this->device->import($processor->export());
|
$this->device->import($processor->export());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class Barrage
|
|||||||
}
|
}
|
||||||
self::setPauseStatus();
|
self::setPauseStatus();
|
||||||
if (self::sendMsg()) {
|
if (self::sendMsg()) {
|
||||||
self::setLock(mt_rand(40, 80) * 60);
|
self::setLock(mt_rand(180, 240) * 60);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self::setLock(15 * 60);
|
self::setLock(15 * 60);
|
||||||
|
|||||||
@ -332,12 +332,14 @@ class Live
|
|||||||
* @param int $page_size
|
* @param int $page_size
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function fetchMedalList(int $page_size = 100): array
|
public static function fetchMedalList(int $page_size = 10): array
|
||||||
{
|
{
|
||||||
$metal_list = [];
|
$metal_list = [];
|
||||||
for ($i = 1; $i <= 10; $i++) {
|
for ($i = 1; $i <= 100; $i++) {
|
||||||
|
// https://live.bilibili.com/p/html/live-app-fansmedal-manange/index.html
|
||||||
// $url = 'https://api.live.bilibili.com/fans_medal/v5/live_fans_medal/iApiMedal';
|
// $url = 'https://api.live.bilibili.com/fans_medal/v5/live_fans_medal/iApiMedal';
|
||||||
$url = 'https://api.live.bilibili.com/i/api/medal';
|
$url = 'https://api.live.bilibili.com/i/api/medal';
|
||||||
|
// TODO size变小 需要优化获取逻辑 可能会412
|
||||||
$payload = [
|
$payload = [
|
||||||
'page' => $i,
|
'page' => $i,
|
||||||
'pageSize' => $page_size
|
'pageSize' => $page_size
|
||||||
|
|||||||
@ -189,7 +189,8 @@ class Notice
|
|||||||
private static function teleSend(array $info)
|
private static function teleSend(array $info)
|
||||||
{
|
{
|
||||||
Log::info('使用Tele机器人推送消息');
|
Log::info('使用Tele机器人推送消息');
|
||||||
$url = 'https://api.telegram.org/bot' . getConf('bottoken', 'notify.telegram') . '/sendMessage';
|
$base_url = getConf('url', 'notify.telegram') ?: 'https://api.telegram.org/bot';
|
||||||
|
$url = $base_url . getConf('bottoken', 'notify.telegram') . '/sendMessage';
|
||||||
$payload = [
|
$payload = [
|
||||||
'chat_id' => getConf('chatid', 'notify.telegram'),
|
'chat_id' => getConf('chatid', 'notify.telegram'),
|
||||||
'text' => $info['content']
|
'text' => $info['content']
|
||||||
|
|||||||
@ -77,7 +77,7 @@ class UnFollow extends BaseTask
|
|||||||
* @return array
|
* @return array
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
private static function relationTag($tag_id, int $max_pn = 30, int $max_ps = 20): array
|
private static function relationTag($tag_id, int $max_pn = 60, int $max_ps = 20): array
|
||||||
{
|
{
|
||||||
$following = [];
|
$following = [];
|
||||||
$url = 'https://api.bilibili.com/x/relation/tag';
|
$url = 'https://api.bilibili.com/x/relation/tag';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user