From 4792167bff8800b7fa0c1767d2ccd88f0beea3bd Mon Sep 17 00:00:00 2001 From: Lkeme <19500576+lkeme@users.noreply.github.com> Date: Mon, 26 Apr 2021 16:38:30 +0800 Subject: [PATCH 01/28] [fix] XliveHeartBeat --- src/plugin/Barrage.php | 4 +- src/tool/Common.php | 14 +- src/util/XliveHeartBeat.php | 374 ++++++++++++++++++++---------------- 3 files changed, 224 insertions(+), 168 deletions(-) diff --git a/src/plugin/Barrage.php b/src/plugin/Barrage.php index dd8d674..da1e460 100644 --- a/src/plugin/Barrage.php +++ b/src/plugin/Barrage.php @@ -134,13 +134,13 @@ class Barrage */ private static function privateSendMsg($info): bool { - //TODO 短期功能 有需求就修改 + //TODO 短期功能 有需求就修改 // todo 加入直播间 $response = self::sendMsg($info); if (isset($response['code']) && $response['code'] == 0) { Log::info('弹幕发送成功'); return true; } else { - Log::warning("弹幕发送失败, CODE -> {$response['code']} MSG -> {$response['msg']} "); + Log::warning("弹幕发送失败, CODE -> {$response['code']} MSG -> {$response} "); return false; } } diff --git a/src/tool/Common.php b/src/tool/Common.php index 0738cd4..b8566fa 100644 --- a/src/tool/Common.php +++ b/src/tool/Common.php @@ -12,6 +12,18 @@ namespace BiliHelper\Tool; class Common { + + /** + * @use 获取十三位时间戳 + * @return int + */ + public static function getMillisecond(): int + { + list($t1, $t2) = explode(' ', microtime()); + // return (float)sprintf('%.0f', (floatval($t1) + floatval($t2)) * 1000); + return intval(sprintf('%u', (floatval($t1) + floatval($t2)) * 1000)); + } + /** * @use 替换字符串 * @param $str @@ -21,7 +33,7 @@ class Common * @param string $charset * @return string */ - public static function replaceStar($str, $start, $end = 0, $dot = "*", $charset = "UTF-8") + public static function replaceStar($str, $start, $end = 0, $dot = "*", $charset = "UTF-8"): string { $len = mb_strlen($str, $charset); if ($start == 0 || $start > $len) { diff --git a/src/util/XliveHeartBeat.php b/src/util/XliveHeartBeat.php index 06e5075..0c5cf3d 100644 --- a/src/util/XliveHeartBeat.php +++ b/src/util/XliveHeartBeat.php @@ -32,27 +32,14 @@ trait XliveHeartBeat protected static $_default = 0; // 默认值 - - /** - * @use 重置变量 - * @param false $force - */ - protected static function resetVar($force = false) - { - if ($force) { - static::$_room_info = []; - static::$_current_room_id = 0; - - static::$_retry = 3; - static::$_count_num = 0; - static::$_count_time = 0; - } - $data = [ - 'id' => static::$_data['id'], - ]; - $data["id"][2] = 0; - static::$_data = $data; - } + // 请求配置 + protected static $_user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36'; + protected static $_headers = [ + 'content-type' => 'application/x-www-form-urlencoded', + 'origin' => 'https://live.bilibili.com', + 'referer' => 'https://live.bilibili.com/', + 'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36' + ]; /** @@ -92,28 +79,214 @@ trait XliveHeartBeat $r_data = static::heartBeatIterator(); $index = static::$_data['id'][2]; if ($r_data['code'] != 0) { + Log::warning("心跳失败-$index {$r_data['message']}"); + // 失败心跳 if (static::$_retry) { - Log::warning("心跳失败-$index {$r_data['message']}"); + // 重试次数 > 1 , 不全部清除 static::resetVar(); static::$_retry -= 1; - return static::$_default; + } else { + // 重试次数 < 1 , 全部清除 + static::resetVar(true); } - } - static::$_count_num += 1; - static::$_count_time += $r_data['heartbeat_interval']; + return static::$_default; + } else { + // 成功心跳 + static::$_count_num += 1; + static::$_count_time += $r_data['heartbeat_interval']; - // 最大次数限制 - if ($max_num <= static::$_count_num) { - // 成功在id为{room_id}的直播间发送完{ii}次心跳,退出直播心跳(达到最大心跳次数) + // 最大次数限制 + if ($max_num <= static::$_count_num) { + // 成功在id为{room_id}的直播间发送完{ii}次心跳,退出直播心跳(达到最大心跳次数) + } + // 最大时间限制 + if ($max_time <= static::$_count_time) { + //成功在id为{room_id}的直播间发送第{ii}次心跳 + } + $minute = round(static::$_count_time / 60); + Log::info("已在直播间 $room_id 连续观看了 $minute 分钟"); + return $r_data['heartbeat_interval']; } - // 最大时间限制 - if ($max_time <= static::$_count_time) { - //成功在id为{room_id}的直播间发送第{ii}次心跳 - } - $minute = round(static::$_count_time / 60); - Log::info("已在直播间 $room_id 连续观看了 $minute 分钟"); - return $r_data['heartbeat_interval']; + } + /** + * @use 心跳迭代 + * @return array + */ + protected static function heartBeatIterator(): array + { +// print_r(static::$_data); + $rdata = []; + # 第1次执行 eHeartBeat + if (static::$_data['id'][2] == 0) { + $r_data = static::eHeartBeat(static::$_data['id']); + } else { + # 第1次之后执行 xHeartBeat + static::$_data['ts'] = time() * 1000; + static::$_data['s'] = static::encParamS(static::$_data, static::$_secret_rule); + if (!static::$_data['s']) { + return [404, '心跳加密错误', '心跳加密错误']; + } + $r_data = static::xHeartBeat(static::$_data['id']); + } + if ($r_data['code'] == 0) { + $rdata = $r_data['data']; + static::$_data['ets'] = $rdata['timestamp']; + static::$_data['benchmark'] = $rdata['secret_key']; + static::$_data['time'] = $rdata['heartbeat_interval']; + static::$_secret_rule = $rdata['secret_rule']; + static::$_data['id'][2] += 1; + } + Log::debug(json_encode(static::$_data['id'], true)); + return [ + 'code' => $r_data['code'], + 'message' => $r_data['message'], + 'heartbeat_interval' => array_key_exists('heartbeat_interval', $rdata) ? $rdata['heartbeat_interval'] : static::$_default + ]; + } + + /** + * @use E心跳 + * @param array $id + * @return array|false[] + */ + protected static function eHeartBeat(array $id): array + { + $url = 'https://live-trace.bilibili.com/xlive/data-interface/v1/x25Kn/E'; + $user_info = User::parseCookies(); + $payload = [ + 'id' => json_encode([$id[0], $id[1], $id[2], $id[3]], true), + 'device' => json_encode([Generator::hash(), Generator::uuid4()], true), + 'ts' => time() * 1000, + 'is_patch' => 0, + 'heart_beat' => [], + 'ua' => static::$_user_agent, + 'csrf_token' => $user_info['token'], + 'csrf' => $user_info['token'], + 'visit_id' => '' + ]; + // print_r($payload); + Log::debug(json_encode($payload, true)); + $raw = Curl::post('pc', $url, $payload, static::$_headers); + // {'code':0,'message':'0','ttl':1,'data':{'timestamp':1595342828,'heartbeat_interval':300,'secret_key':'seacasdgyijfhofiuxoannn','secret_rule':[2,5,1,4],'patch_status':2}} + + unset($payload['id']); + static::$_data = array_merge_recursive(static::$_data, $payload); + + return json_decode($raw, true); + } + + /** + * @use X心跳 + * @param array $id + * @return array|bool[] + */ + protected static function xHeartBeat(array $id): array + { + $url = 'https://live-trace.bilibili.com/xlive/data-interface/v1/x25Kn/X'; + $payload = [ + 's' => static::$_data['s'], + 'id' => json_encode([$id[0], $id[1], $id[2], $id[3]], true), + 'device' => static::$_data['device'], + 'ets' => static::$_data['ets'], + 'benchmark' => static::$_data['benchmark'], + 'time' => static::$_data['time'], + 'ts' => static::$_data['ts'], + 'ua' => static::$_data['ua'], + 'csrf_token' => static::$_data['csrf_token'], + 'csrf' => static::$_data['csrf'], + 'visit_id' => '' + ]; +// print_r($payload); + Log::debug(json_encode($payload, true)); + $raw = Curl::post('pc', $url, $payload, static::$_headers); + # {"code":0,"message":"0","ttl":1,"data":{"heartbeat_interval":60,"timestamp":1619419450,"secret_rule":[2,5,1,4],"secret_key":"seacasdgyijfhofiuxoannn"}} + # {'code':0,'message':'0','ttl':1,'data':{'heartbeat_interval':300,'timestamp':1595346846,'secret_rule':[2,5,1,4],'secret_key':'seacasdgyijfhofiuxoannn'}} + return json_decode($raw, true); + } + + /** + * @use 加密参数S + * @param array $t + * @param array $r + * @return string|false + */ + protected static function encParamS(array $t, array $r) + { + $headers = [ + 'Content-Type' => 'application/json', + ]; + // 加密部分 + $payload = [ + 't' => static::formatT($t), + 'r' => static::formatR($r) + ]; +// print_r($payload); + $data = Curl::put('other', static::$_enc_server, $payload, $headers); + $de_raw = json_decode($data, true); + if ($de_raw['code'] == 0) { + if (array_key_exists('s', $de_raw)) { + // Log::info("S加密成功 {$de_raw['s']}"); + return $de_raw['s']; + } + Log::warning("S加密失败 加密服务器暂时错误,请检查更换"); + } else { + Log::warning("S加密失败 {$de_raw['message']}"); + } + return false; + } + + + /** + * @use 格式T + * @param array $t + * @return array + */ + protected static function formatT(array $t): array + { +// print_r($t); + return [ + 'id' => $t['id'], + 'device' => $t['device'], + 'ets' => $t['ets'], + 'benchmark' => $t['benchmark'], + 'time' => $t['time'], + 'ts' => $t['ts'], + 'ua' => $t['ua'], + ]; + } + + /** + * @use 格式R + * @param array $r + * @return array + */ + protected static function formatR(array $r): array + { + return $r; + } + + /** + * @use 重置变量 + * @param false $force + */ + protected static function resetVar($force = false) + { + if ($force) { + static::$_room_info = []; + static::$_current_room_id = 0; + + static::$_retry = 3; + static::$_count_num = 0; + static::$_count_time = 0; + } + static::$_data = null; + static::$_data = ['id' => []]; + $data = [ + 'id' => static::$_data['id'], + ]; + $data["id"][2] = 0; + static::$_data = $data; } /** @@ -132,133 +305,4 @@ trait XliveHeartBeat return true; } - - /** - * @use 心跳迭代 - * @return array - */ - protected static function heartBeatIterator(): array - { - $rdata = []; - # 第1次执行 eHeartBeat - if (static::$_data['id'][2] == 0) { - $r_data = static::eHeartBeat(static::$_data['id']); - } else { - # 第1次之后执行 xHeartBeat - static::$_data['ts'] = time() * 1000; - static::$_data['s'] = static::encParamS(static::$_data, static::$_secret_rule); - $r_data = static::xHeartBeat(static::$_data['id']); - } - if ($r_data['code'] == 0) { - $rdata = $r_data['data']; - static::$_data['ets'] = $rdata['timestamp']; - static::$_data['benchmark'] = $rdata['secret_key']; - static::$_data['time'] = $rdata['heartbeat_interval']; - static::$_secret_rule = $rdata['secret_rule']; - static::$_data['id'][2] += 1; - } - Log::debug(json_encode(static::$_data['id'], true)); - return [ - 'code' => $r_data['code'], - 'message' => $r_data['message'], - 'heartbeat_interval' => $rdata['heartbeat_interval'] - ]; - } - - - /** - * @use E心跳 - * @param array $id - * @return array|false[] - */ - protected static function eHeartBeat(array $id): array - { - $url = 'https://live-trace.bilibili.com/xlive/data-interface/v1/x25Kn/E'; - $headers = [ - 'Content-Type' => 'application/x-www-form-urlencoded', - 'Origin' => 'https://live.bilibili.com', - 'Referer' => 'https://live.bilibili.com/' . $id[3], - ]; - $user_info = User::parseCookies(); - $payload = [ - 'id' => json_encode([$id[0], $id[1], $id[2], $id[3]], true), - 'device' => json_encode([Generator::hash(), Generator::uuid4()], true), - 'ts' => time() * 1000, - 'is_patch' => 0, - 'heart_beat' => [], - 'ua' => 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0', - 'csrf_token' => $user_info['token'], - 'csrf' => $user_info['token'], - 'visit_id' => '' - ]; - // print_r($payload); - Log::debug(json_encode($payload, true)); - $raw = Curl::post('pc', $url, $payload, $headers); - // {'code':0,'message':'0','ttl':1,'data':{'timestamp':1595342828,'heartbeat_interval':300,'secret_key':'seacasdgyijfhofiuxoannn','secret_rule':[2,5,1,4],'patch_status':2}} - - unset($payload['id']); - static::$_data = array_merge_recursive(static::$_data, $payload); - - return json_decode($raw, true); - } - - /** - * @use X心跳 - * @param array $id - * @return array|bool[] - */ - protected static function xHeartBeat(array $id): array - { - $url = 'https://live-trace.bilibili.com/xlive/data-interface/v1/x25Kn/X'; - $user_info = User::parseCookies(); - $headers = [ - 'Content-Type' => 'application/x-www-form-urlencoded', - 'Origin' => 'https://live.bilibili.com', - 'Referer' => 'https://live.bilibili.com/' . $id[3], - ]; - $payload = [ - 's' => static::$_data['s'], - 'id' => json_encode([$id[0], $id[1], $id[2], $id[3]], true), - 'device' => static::$_data['device'], - 'ets' => static::$_data['ets'], - 'benchmark' => static::$_data['benchmark'], - 'time' => static::$_data['time'], - 'ts' => static::$_data['ts'], - 'ua' => static::$_data['ua'], - 'csrf_token' => $user_info['token'], - 'csrf' => $user_info['token'], - 'visit_id' => '' - ]; -// print_r($payload); - Log::debug(json_encode($payload, true)); - $raw = Curl::post('pc', $url, $payload, $headers); - # {'code':0,'message':'0','ttl':1,'data':{'heartbeat_interval':300,'timestamp':1595346846,'secret_rule':[2,5,1,4],'secret_key':'seacasdgyijfhofiuxoannn'}} - return json_decode($raw, true); - } - - /** - * @use 加密参数S - * @param array $t - * @param array $r - * @return string|false - */ - protected static function encParamS(array $t, array $r) - { - $headers = [ - 'Content-Type' => 'application/json', - ]; - // 加密部分 - $payload = ['t' => $t, 'r' => $r]; - $data = Curl::put('other', static::$_enc_server, $payload, $headers); - $de_raw = json_decode($data, true); - if ($de_raw['code'] == 0) { - // Log::info("S加密成功 {$de_raw['s']}"); - return $de_raw['s']; - } else { - Log::warning("S加密失败 {$de_raw['message']}"); - return false; - } - } - - } \ No newline at end of file From a3196bb053cd22507e456f79543b186ea9f377a1 Mon Sep 17 00:00:00 2001 From: Lkeme <19500576+lkeme@users.noreply.github.com> Date: Mon, 26 Apr 2021 18:20:26 +0800 Subject: [PATCH 02/28] [fix] XliveHeartBeat --- src/util/XliveHeartBeat.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/util/XliveHeartBeat.php b/src/util/XliveHeartBeat.php index 0c5cf3d..e017f71 100644 --- a/src/util/XliveHeartBeat.php +++ b/src/util/XliveHeartBeat.php @@ -60,7 +60,7 @@ trait XliveHeartBeat static::resetVar(true); static::$_current_room_id = $room_id; } - // 加载房间信息 + // 获取房间信息 if (empty(static::$_room_info)) { $r_data = Live::webGetRoomInfo($room_id); if ($r_data['code'] != 0) { @@ -68,7 +68,10 @@ trait XliveHeartBeat return static::$_default; } static::$_room_info = $r_data; - $rdata = $r_data['data']; + } + // 加载房间信息 + if (static::$_room_info && static::$_data["id"][2] == 0){ + $rdata = static::$_room_info['data']; $parent_area_id = $rdata['room_info']['parent_area_id']; $area_id = $rdata['room_info']['area_id']; # 短位转长位 @@ -83,7 +86,7 @@ trait XliveHeartBeat // 失败心跳 if (static::$_retry) { // 重试次数 > 1 , 不全部清除 - static::resetVar(); + static::resetVar(true); static::$_retry -= 1; } else { // 重试次数 < 1 , 全部清除 @@ -103,7 +106,7 @@ trait XliveHeartBeat if ($max_time <= static::$_count_time) { //成功在id为{room_id}的直播间发送第{ii}次心跳 } - $minute = round(static::$_count_time / 60); + $minute = round(static::$_count_time / 60) - 1; Log::info("已在直播间 $room_id 连续观看了 $minute 分钟"); return $r_data['heartbeat_interval']; } @@ -125,7 +128,11 @@ trait XliveHeartBeat static::$_data['ts'] = time() * 1000; static::$_data['s'] = static::encParamS(static::$_data, static::$_secret_rule); if (!static::$_data['s']) { - return [404, '心跳加密错误', '心跳加密错误']; + return [ + 'code' => 404, + 'message' => '心跳加密错误', + 'heartbeat_interval' => static::$_default + ]; } $r_data = static::xHeartBeat(static::$_data['id']); } @@ -229,9 +236,9 @@ trait XliveHeartBeat // Log::info("S加密成功 {$de_raw['s']}"); return $de_raw['s']; } - Log::warning("S加密失败 加密服务器暂时错误,请检查更换"); + Log::warning("参数S加密失败: 加密服务器暂时错误,请检查更换"); } else { - Log::warning("S加密失败 {$de_raw['message']}"); + Log::warning("参数S加密失败: {$de_raw['message']}"); } return false; } From 26329986ac335d5d756be68eaf6e86bf1991cf98 Mon Sep 17 00:00:00 2001 From: Lkeme <19500576+lkeme@users.noreply.github.com> Date: Mon, 26 Apr 2021 21:23:45 +0800 Subject: [PATCH 03/28] [fix] XliveHeartBeat --- src/plugin/AnchorRaffle.php | 2 +- src/plugin/Barrage.php | 10 +++++----- src/plugin/GiftSend.php | 2 +- src/plugin/Live.php | 27 +++++++++++++++++++++------ src/util/XliveHeartBeat.php | 5 +---- 5 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/plugin/AnchorRaffle.php b/src/plugin/AnchorRaffle.php index 5d44579..8fda769 100644 --- a/src/plugin/AnchorRaffle.php +++ b/src/plugin/AnchorRaffle.php @@ -65,7 +65,7 @@ class AnchorRaffle extends BaseRaffle self::$group_id = $tag_id ? $tag_id : User::createRelationTag(self::$group_name); } // 获取需要关注的 - $data = Live::getRoomInfo($room_id); + $data = Live::getRoomInfoV1($room_id); if ($data['code'] == 0 && isset($data['data'])) { $need_follow_uid = $data['data']['uid']; } else { diff --git a/src/plugin/Barrage.php b/src/plugin/Barrage.php index da1e460..c8fe25f 100644 --- a/src/plugin/Barrage.php +++ b/src/plugin/Barrage.php @@ -33,11 +33,11 @@ class Barrage ]; if (self::privateSendMsg($info)) { - self::setLock(mt_rand(40, 60) * 60); + self::setLock(mt_rand(40, 80) * 60); return; } - self::setLock(30); + self::setLock(10 * 60); } /** @@ -64,7 +64,7 @@ class Barrage * @use 获取一言api消息 * @return string */ - private static function getMsgInfo():string + private static function getMsgInfo(): string { /** * 整理一部分API,收集于网络,侵权麻烦联系我删除. @@ -112,7 +112,7 @@ class Barrage { $user_info = User::parseCookies(); $url = 'https://api.live.bilibili.com/msg/send'; - $data = Live::getRoomInfo($info['roomid']); + $data = Live::getRoomInfoV1($info['roomid']); $payload = [ 'color' => '16777215', 'fontsize' => 25, @@ -140,7 +140,7 @@ class Barrage Log::info('弹幕发送成功'); return true; } else { - Log::warning("弹幕发送失败, CODE -> {$response['code']} MSG -> {$response} "); + Log::warning("弹幕发送失败, CODE -> {$response['code']} MSG -> {$response['message']} "); return false; } } diff --git a/src/plugin/GiftSend.php b/src/plugin/GiftSend.php index fd2f588..74a4021 100644 --- a/src/plugin/GiftSend.php +++ b/src/plugin/GiftSend.php @@ -226,7 +226,7 @@ class GiftSend { Log::info('正在生成直播间信息...'); $room_id = empty(self::$tid) ? getenv('ROOM_ID') : self::$tid; - $data = Live::getRoomInfo($room_id); + $data = Live::getRoomInfoV1($room_id); if (isset($data['code']) && $data['code']) { Log::warning('获取主播房间号失败!', ['msg' => $data['message']]); Log::warning('清空礼物功能禁用!'); diff --git a/src/plugin/Live.php b/src/plugin/Live.php index 5f3300e..22ce07e 100644 --- a/src/plugin/Live.php +++ b/src/plugin/Live.php @@ -82,7 +82,7 @@ class Live * @use 获取随机直播房间号 * @return int */ - public static function getUserRecommend() + public static function getUserRecommend(): int { $url = 'https://api.live.bilibili.com/room/v1/Area/getListByAreaID'; $payload = [ @@ -105,9 +105,9 @@ class Live * @param $room_id * @return bool */ - public static function getRealRoomID($room_id) + public static function getRealRoomID($room_id): bool { - $data = self::getRoomInfo($room_id); + $data = self::getRoomInfoV1($room_id); if (!isset($data['code']) || !isset($data['data'])) { return false; } @@ -132,7 +132,7 @@ class Live * @param $room_id * @return array */ - public static function getRoomInfo($room_id): array + public static function getRoomInfoV1($room_id): array { $url = 'https://api.live.bilibili.com/room/v1/Room/room_init'; $payload = [ @@ -142,6 +142,21 @@ class Live return json_decode($raw, true); } + /** + * @use 获取直播间信息 + * @param $room_id + * @return array + */ + public static function getRoomInfoV2($room_id): array + { + $url = ' https://api.live.bilibili.com/room/v1/Room/get_info_by_id'; + $payload = [ + 'ids[]' => $room_id + ]; + $raw = Curl::get('other', $url, $payload); + return json_decode($raw, true); + } + /** * @use 获取弹幕配置 * @param $room_id @@ -230,7 +245,7 @@ class Live * @use 获取毫秒 * @return float */ - public static function getMillisecond() + public static function getMillisecond(): float { list($t1, $t2) = explode(' ', microtime()); return (float)sprintf('%.0f', (floatval($t1) + floatval($t2)) * 1000); @@ -383,7 +398,7 @@ class Live * @param int $page * @return array */ - public static function getAreaRoomList(int $parent_area_id, int $area_id, int $page=1): array + public static function getAreaRoomList(int $parent_area_id, int $area_id, int $page = 1): array { $url = 'https://api.live.bilibili.com/xlive/web-interface/v1/second/getList'; $payload = [ diff --git a/src/util/XliveHeartBeat.php b/src/util/XliveHeartBeat.php index e017f71..24c0cdd 100644 --- a/src/util/XliveHeartBeat.php +++ b/src/util/XliveHeartBeat.php @@ -68,10 +68,7 @@ trait XliveHeartBeat return static::$_default; } static::$_room_info = $r_data; - } - // 加载房间信息 - if (static::$_room_info && static::$_data["id"][2] == 0){ - $rdata = static::$_room_info['data']; + $rdata = $r_data['data']; $parent_area_id = $rdata['room_info']['parent_area_id']; $area_id = $rdata['room_info']['area_id']; # 短位转长位 From 34bffe404f377b37afa59d5e82e5ad30030bbd87 Mon Sep 17 00:00:00 2001 From: Lkeme <19500576+lkeme@users.noreply.github.com> Date: Tue, 11 May 2021 16:50:20 +0800 Subject: [PATCH 04/28] [add] CheckUpdate [update] Login --- composer.json | 3 +- composer.lock | 96 ++++++++++++--- data/activity_infos.json | 33 +++++ data/latest.json | 10 ++ src/core/App.php | 1 + src/plugin/CheckUpdate.php | 91 ++++++++++++++ src/plugin/Login.php | 223 ++++++++++++++++------------------ src/plugin/PolishTheMetal.php | 1 + 8 files changed, 326 insertions(+), 132 deletions(-) create mode 100644 data/latest.json create mode 100644 src/plugin/CheckUpdate.php create mode 100644 src/plugin/PolishTheMetal.php diff --git a/composer.json b/composer.json index 1ad3703..0f2ca84 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,8 @@ "guzzlehttp/guzzle": "^6.5.5", "mathieuviossat/arraytotexttable": "^1.0.8", "klkvsk/json-decode-stream": "^1.0", - "sven/file-config": "^3.1" + "sven/file-config": "^3.1", + "hassankhan/config": "^2.2" }, "license": "MIT", "authors": [ diff --git a/composer.lock b/composer.lock index 6f574d2..4db83f8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a9407272d4bb9ca1632a2aa728429bf0", + "content-hash": "7b0e5cfde9ebb70a16c941f59fd2a71d", "packages": [ { "name": "amphp/amp", @@ -460,16 +460,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.8.1", + "version": "1.8.2", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "35ea11d335fd638b5882ff1725228b3d35496ab1" + "reference": "dc960a912984efb74d0a90222870c72c87f10c91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/35ea11d335fd638b5882ff1725228b3d35496ab1", - "reference": "35ea11d335fd638b5882ff1725228b3d35496ab1", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/dc960a912984efb74d0a90222870c72c87f10c91", + "reference": "dc960a912984efb74d0a90222870c72c87f10c91", "shasum": "", "mirrors": [ { @@ -535,9 +535,77 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.8.1" + "source": "https://github.com/guzzle/psr7/tree/1.8.2" }, - "time": "2021-03-21T16:25:00+00:00" + "time": "2021-04-26T09:17:50+00:00" + }, + { + "name": "hassankhan/config", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/hassankhan/config.git", + "reference": "62b0fd17540136efa94ab6b39f04044c6dc5e4a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hassankhan/config/zipball/62b0fd17540136efa94ab6b39f04044c6dc5e4a7", + "reference": "62b0fd17540136efa94ab6b39f04044c6dc5e4a7", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.5.9" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.36 || ~5.7 || ~6.5 || ~7.5", + "scrutinizer/ocular": "~1.1", + "squizlabs/php_codesniffer": "~2.2", + "symfony/yaml": "~3.4" + }, + "suggest": { + "symfony/yaml": "~3.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Noodlehaus\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Hassan Khan", + "homepage": "http://hassankhan.me/", + "role": "Developer" + } + ], + "description": "Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files", + "homepage": "http://hassankhan.me/config/", + "keywords": [ + "config", + "configuration", + "ini", + "json", + "microphp", + "unframework", + "xml", + "yaml", + "yml" + ], + "support": { + "issues": "https://github.com/hassankhan/config/issues", + "source": "https://github.com/hassankhan/config/tree/2.2.0" + }, + "time": "2020-12-07T16:04:15+00:00" }, { "name": "klkvsk/json-decode-stream", @@ -1229,16 +1297,16 @@ }, { "name": "psr/log", - "version": "1.1.3", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "", "mirrors": [ { @@ -1268,7 +1336,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -1279,9 +1347,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.3" + "source": "https://github.com/php-fig/log/tree/1.1.4" }, - "time": "2020-03-23T09:12:05+00:00" + "time": "2021-05-03T11:20:27+00:00" }, { "name": "ralouphie/getallheaders", diff --git a/data/activity_infos.json b/data/activity_infos.json index 90c1d60..61dcc47 100644 --- a/data/activity_infos.json +++ b/data/activity_infos.json @@ -87,6 +87,39 @@ "share": "true", "draw_times": 1, "expire_at": "2021-04-25 23:59:59" + }, + { + "url": "https://www.bilibili.com/blackboard/activity-Tpo81ydpiW.html", + "title": "和平精英周年庆嘉年华1次", + "description": "活动期间每天分享页面,新增一次机会。", + "sid": "e2d93baa-96b9-11eb-8597-246e966235d8", + "login": "true", + "follow": "false", + "share": "true", + "draw_times": 1, + "expire_at": "2021-06-15 23:59:59" + }, + { + "url": "https://www.bilibili.com/blackboard/activity-Tpo81ydpiW.html", + "title": "和平精英周年庆嘉年华2次", + "description": "活动期间每天分享页面,新增一次机会。", + "sid": "e2d93baa-96b9-11eb-8597-246e966235d8", + "login": "true", + "follow": "false", + "share": "true", + "draw_times": 1, + "expire_at": "2021-06-15 23:59:59" + }, + { + "url": "https://www.bilibili.com/blackboard/activity-Tpo81ydpiW.html", + "title": "和平精英周年庆嘉年华3次", + "description": "活动期间每天分享页面,新增一次机会。", + "sid": "e2d93baa-96b9-11eb-8597-246e966235d8", + "login": "true", + "follow": "false", + "share": "true", + "draw_times": 1, + "expire_at": "2021-06-15 23:59:59" } ] } \ No newline at end of file diff --git a/data/latest.json b/data/latest.json new file mode 100644 index 0000000..1f9e8b1 --- /dev/null +++ b/data/latest.json @@ -0,0 +1,10 @@ +{ + "code": 0, + "project":"BiliHelper-personal", + "branch": "master", + "source": "https://github.com/lkeme/BiliHelper-personal", + "raw_url": "https://cdn.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest.json", + "version": "0.8.1.210423", + "des": "程序有更新哦,请及时线上查看。", + "time": '2021年5月6日15:42:40' +} \ No newline at end of file diff --git a/src/core/App.php b/src/core/App.php index fccc7d2..fd17205 100644 --- a/src/core/App.php +++ b/src/core/App.php @@ -66,6 +66,7 @@ class App public function start() { $plugins = [ + 'CheckUpdate', 'Login', 'Schedule', 'MainSite', diff --git a/src/plugin/CheckUpdate.php b/src/plugin/CheckUpdate.php new file mode 100644 index 0000000..86afdb9 --- /dev/null +++ b/src/plugin/CheckUpdate.php @@ -0,0 +1,91 @@ + time()) { + return; + } + self::check(); + self::setLock(8 * 60 * 60); + } + + /** + * @use 检查 + */ + private static function check() + { + Log::info('开始检查项目更新'); + self::loadJsonData(); + Log::info('拉取线上最新配置'); + self::fetchLatest(); + if (!self::compareVersion()) { + Log::info('项目已是最新版本'); + } else { + Log::notice('项目有更新'); + // TODO 完善提示信息 + $time = self::$latest_conf->get('time'); + $version = self::$latest_conf->get('version'); + $des = self::$latest_conf->get('des'); + $info = "最新版本-{$version}, {$des}"; + Notice::push('update', $info); + } + } + + /** + * @use 拉取最新 + */ + private static function fetchLatest() + { + $url = self::$conf->get('raw_url'); + $payload = []; + $raw = Curl::get('other', $url, $payload); + self::$latest_conf = new Config($raw, new Json, true); + } + + /** + * @use 加载本地JSON DATA + */ + private static function loadJsonData() + { + self::$conf = new Config(self::$repository); + } + + /** + * @use 比较版本号 + * @return bool + */ + private static function compareVersion(): bool + { + $current_version = self::$conf->get('version'); + $latest_version = self::$latest_conf->get('version'); + // true 有更新 false 无更新 + return !($current_version == $latest_version); + } + +} \ No newline at end of file diff --git a/src/plugin/Login.php b/src/plugin/Login.php index 0fd04ab..18eff7f 100644 --- a/src/plugin/Login.php +++ b/src/plugin/Login.php @@ -48,7 +48,6 @@ class Login self::setLock(3600); } - /** * @use 登录控制中心 */ @@ -92,12 +91,11 @@ class Login self::$password = self::publicKeyEnc($pass); } - /** * @use 保持认证 * @return bool */ - private static function keepAuth() + private static function keepAuth(): bool { if (self::getLock() > time()) { return true; @@ -119,7 +117,7 @@ class Login * @use 获取令牌信息 * @return bool */ - private static function checkToken() + private static function checkToken(): bool { $url = 'https://passport.bilibili.com/api/v2/oauth2/info'; $payload = [ @@ -135,11 +133,10 @@ class Login return $data['data']['expires_in'] > 14400; } - /** * @use 刷新Token */ - private static function refreshToken() + private static function refreshToken(): bool { $url = 'https://passport.bilibili.com/api/v2/oauth2/refresh_token'; $payload = [ @@ -163,35 +160,6 @@ class Login return true; } - /** - * @use 检查Cookie - */ - private static function checkCookie() - { - - } - - - /** - * @use 刷新Cookie - */ - private static function refreshCookie() - { - $url = 'https://passport.bilibili.com/api/login/sso'; - $payload = [ - 'gourl' => 'https%3A%2F%2Faccount.bilibili.com%2Faccount%2Fhome' - ]; - $response = Curl::headers('app', $url, Sign::common($payload)); - $headers = $response['Set-Cookie']; - $cookies = []; - foreach ($headers as $header) { - preg_match_all('/^(.*);/iU', $header, $cookie); - array_push($cookies, $cookie[0][0]); - } - return implode("", array_reverse($cookies)); - } - - /** * @use 公钥加密 * @param $plaintext @@ -218,7 +186,6 @@ class Login return base64_encode($crypt); } - /** * @use 获取验证码 * @return array|string[] @@ -273,7 +240,6 @@ class Login ]; } - /** * @use 验证码登录 * @param string $mode @@ -293,8 +259,8 @@ class Login */ private static function accountLogin(string $validate = '', string $challenge = '', string $mode = '账密模式') { - Log::info("尝试{$mode}登录"); -// $url = 'https://passport.bilibili.com/api/v3/oauth2/login'; + Log::info("尝试 {$mode} 登录"); + // $url = 'https://passport.bilibili.com/api/v3/oauth2/login'; $url = 'https://passport.bilibili.com/x/passport-login/oauth2/login'; $payload = [ 'seccode' => $validate ? "{$validate}|jordan" : '', @@ -314,50 +280,7 @@ class Login // {"ts":1593082432,"code":0,"data":{"status":0,"token_info":{"mid":123456,"access_token":"123123","refresh_token":"123123","expires_in":2592000},"cookie_info":{"cookies":[{"name":"bili_jct","value":"123123","http_only":0,"expires":1595674432},{"name":"DedeUserID","value":"123456","http_only":0,"expires":1595674432},{"name":"DedeUserID__ckMd5","value":"123123","http_only":0,"expires":1595674432},{"name":"sid","value":"bd6aagp7","http_only":0,"expires":1595674432},{"name":"SESSDATA","value":"6d74d850%123%2Cf0e36b61","http_only":1,"expires":1595674432}],"domains":[".bilibili.com",".biligame.com",".bigfunapp.cn"]},"sso":["https://passport.bilibili.com/api/v2/sso","https://passport.biligame.com/api/v2/sso","https://passport.bigfunapp.cn/api/v2/sso"]}} // {"ts":1610254019,"code":0,"data":{"status":2,"url":"https://passport.bilibili.com/account/mobile/security/managephone/phone/verify?tmp_token=2bc5dd260df7158xx860565fxx0d5311&requestId=dffcfxx052fe11xxa9c8e2667739c15c&source=risk","message":"您的账号存在高危异常行为,为了您的账号安全,请验证手机号后登录帐号"}} // https://passport.bilibili.com/mobile/verifytel_h5.html - switch ($de_raw['code']) { - case 0: - // 二次判断 - switch ($de_raw['data']['status']) { - case 0: - // 正常登录 - Log::info("{$mode}登录成功"); - $access_token = $de_raw['data']['token_info']['access_token']; - $refresh_token = $de_raw['data']['token_info']['refresh_token']; - self::saveConfig('ACCESS_TOKEN', $access_token); - self::saveConfig('REFRESH_TOKEN', $refresh_token); - self::saveCookie($de_raw); - Log::info('信息配置完毕'); - break; - case 2: - // 异常高危 - Log::error('登录失败', ['msg' => $de_raw['data']['message']]); - die(); - default: - Log::error('登录失败', ['msg' => '未知错误: ' . $de_raw['data']['message']]); - die(); - break; - } - break; - case -105: - // 需要验证码 - Log::error('登录失败', ['msg' => '此次登录需要验证码或' . $de_raw['message']]); - die(); - break; - case -629: - // 密码错误 - Log::error('登录失败', ['msg' => $de_raw['message']]); - die(); - break; - case -2100: - // 验证手机号 - Log::error('登录失败', ['msg' => '账号启用了设备锁或异地登录需验证手机号']); - die(); - break; - default: - Log::error('登录失败', ['msg' => '未知错误: ' . $de_raw['message']]); - die(); - break; - } + self::loginAfter($mode, $de_raw['code'], $de_raw); } /** @@ -366,7 +289,7 @@ class Login */ private static function smsLogin(string $mode = '短信模式') { - Log::info("尝试{$mode}登录"); + Log::info("尝试 {$mode} 登录"); self::checkPhone(self::$username); $captcha = self::sendSms(self::$username); $url = 'https://passport.bilibili.com/x/passport-login/login/sms'; @@ -379,38 +302,7 @@ class Login ]; $raw = Curl::post('app', $url, Sign::login($payload)); $de_raw = json_decode($raw, true); - switch ($de_raw['code']) { - case 0: - // 正常登录 - Log::info("{$mode}登录成功"); - $access_token = $de_raw['data']['token_info']['access_token']; - $refresh_token = $de_raw['data']['token_info']['refresh_token']; - self::saveConfig('ACCESS_TOKEN', $access_token); - self::saveConfig('REFRESH_TOKEN', $refresh_token); - self::saveCookie($de_raw); - Log::info('信息配置完毕'); - break; - case -105: - // 需要验证码 - Log::error('登录失败', ['msg' => '此次登录需要验证码或' . $de_raw['message']]); - die(); - break; - case -629: - // 密码错误 - Log::error('登录失败', ['msg' => $de_raw['message']]); - die(); - break; - case -2100: - // 验证手机号 - Log::error('登录失败', ['msg' => '账号启用了设备锁或异地登录需验证手机号']); - die(); - break; - default: - Log::error('登录失败', ['msg' => '未知错误: ' . $de_raw['message']]); - die(); - break; - } - + self::loginAfter($mode, $de_raw['code'], $de_raw); } /** @@ -454,6 +346,85 @@ class Login die(); } + /** + * @use 登录之后 + * @param $mode + * @param $code + * @param $data + */ + private static function loginAfter($mode, $code, $data) + { + switch ($code) { + case 0: + // data->data->status number + if (array_key_exists('status', $data['data'])) { + // 二次判断 + switch ($data['data']['status']) { + case 0: + // 正常登录 + self::loginSuccess($mode, $data); + break; + case 2: + // 异常高危 + self::loginFail($mode, $data['data']['message']); + break; + default: + // 未知错误 + self::loginFail($mode, '未知错误: ' . $data['data']['message']); + break; + } + } + // 正常登录 + self::loginSuccess($mode, $data); + break; + case -105: + // 需要验证码 + self::loginFail($mode, '此次登录需要验证码或' . $data['message']); + break; + case -629: + // 密码错误 + self::loginFail($mode, $data['message']); + break; + case -2100: + // 验证手机号 + self::loginFail($mode, '账号启用了设备锁或异地登录需验证手机号'); + break; + default: + // 未知错误 + self::loginFail($mode, '未知错误: ' . $data['message']); + break; + } + + } + + /** + * @use 登陆成功 + * @param $mode + * @param $data + */ + private static function loginSuccess($mode, $data) + { + Log::info("{$mode} 登录成功"); + $access_token = $data['data']['token_info']['access_token']; + $refresh_token = $data['data']['token_info']['refresh_token']; + self::saveConfig('ACCESS_TOKEN', $access_token); + self::saveConfig('REFRESH_TOKEN', $refresh_token); + self::saveCookie($data); + Log::info('信息配置完毕'); + } + + /** + * @use 登陆失败 + * @param $mode + * @param $data + */ + private static function loginFail($mode, $data) + { + Log::error("{$mode} 登录失败"); + Log::error('登录失败', ['msg' => $data]); + die(); + } + /** * @use 检查手机号格式 * @param string $phone @@ -475,7 +446,7 @@ class Login private static function saveConfig(string $key, string $value, $hide = true) { Config::put($key, $value); - Log::info(" > {$key}: " . ($hide ? Common::replaceStar($value,4,4) : $value)); + Log::info(" > {$key}: " . ($hide ? Common::replaceStar($value, 4, 4) : $value)); } /** @@ -503,5 +474,23 @@ class Login } } + /** + * @use 刷新Cookie + */ + private static function refreshCookie(): string + { + $url = 'https://passport.bilibili.com/api/login/sso'; + $payload = [ + 'gourl' => 'https%3A%2F%2Faccount.bilibili.com%2Faccount%2Fhome' + ]; + $response = Curl::headers('app', $url, Sign::common($payload)); + $headers = $response['Set-Cookie']; + $cookies = []; + foreach ($headers as $header) { + preg_match_all('/^(.*);/iU', $header, $cookie); + array_push($cookies, $cookie[0][0]); + } + return implode("", array_reverse($cookies)); + } } \ No newline at end of file diff --git a/src/plugin/PolishTheMetal.php b/src/plugin/PolishTheMetal.php new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/src/plugin/PolishTheMetal.php @@ -0,0 +1 @@ + Date: Mon, 17 May 2021 18:35:21 +0800 Subject: [PATCH 05/28] [update] Version 0.9.0 --- .gitignore | 12 +- CHANGELOG.md | 115 ++++++- DOC.md | 227 +++++++------- Dockerfile | 4 +- README.md | 102 ++++++- composer.json | 10 +- composer.lock | 68 ++++- conf/ConfigGenerator.php | 6 +- conf/user.conf.example | 196 ------------ conf/user.ini.example | 279 +++++++++++++++++ data/capsule_infos.json | 26 +- data/{latest.json => latest_version.json} | 8 +- index.php | 7 +- src/core/App.php | 25 +- src/core/Config.php | 102 +++---- src/core/Curl.php | 70 +++-- src/core/Env.php | 37 ++- src/core/Helpers.php | 106 +++++++ src/core/Log.php | 71 ++++- src/plugin/ActivityLottery.php | 22 +- src/plugin/AloneTcpClient.php | 25 +- src/plugin/AnchorRaffle.php | 25 +- src/plugin/AwardRecord.php | 8 +- src/plugin/Barrage.php | 90 ++---- src/plugin/BpConsumption.php | 148 +++++++++ src/plugin/CapsuleLottery.php | 129 +++++++- src/plugin/CheckUpdate.php | 13 +- src/plugin/Competition.php | 16 +- src/plugin/Daily.php | 47 --- src/plugin/DailyBag.php | 67 ++++ src/plugin/DailyTask.php | 20 +- src/plugin/{Heart.php => DoubleHeart.php} | 23 +- src/plugin/Dynamic.php | 33 +- src/plugin/Forward.php | 27 +- src/plugin/GameMatch.php | 355 ---------------------- src/plugin/GiftHeart.php | 5 +- src/plugin/GiftRaffle.php | 15 +- src/plugin/GiftSend.php | 18 +- src/plugin/GroupSignIn.php | 15 +- src/plugin/GuardRaffle.php | 16 +- src/plugin/Judge.php | 77 +++-- src/plugin/Live.php | 75 +++-- src/plugin/Login.php | 133 ++++---- src/plugin/MainSite.php | 104 +++---- src/plugin/ManGa.php | 20 +- src/plugin/MaterialObject.php | 11 +- src/plugin/Notice.php | 71 +++-- src/plugin/PkRaffle.php | 18 +- src/plugin/PolishTheMedal.php | 95 ++++++ src/plugin/PolishTheMetal.php | 1 - src/plugin/Schedule.php | 18 +- src/plugin/Sign.php | 16 +- src/plugin/Silver2Coin.php | 21 +- src/plugin/SmallHeart.php | 54 +--- src/plugin/Statistics.php | 20 +- src/plugin/StormRaffle.php | 17 +- src/plugin/User.php | 93 +++--- src/plugin/VipPrivilege.php | 96 ++++++ src/plugin/ZoneTcpClient.php | 51 ++-- src/tool/BvToAv.php | 13 +- src/tool/Common.php | 19 +- src/tool/DumpMemory.php | 1 - src/tool/Faker.php | 17 +- src/tool/File.php | 2 - src/tool/Generator.php | 23 +- src/util/AllotTasks.php | 2 +- src/util/BaseRaffle.php | 11 +- src/util/TimeLock.php | 4 +- src/util/XliveHeartBeat.php | 11 +- 69 files changed, 2094 insertions(+), 1588 deletions(-) delete mode 100644 conf/user.conf.example create mode 100644 conf/user.ini.example rename data/{latest.json => latest_version.json} (54%) create mode 100644 src/core/Helpers.php create mode 100644 src/plugin/BpConsumption.php delete mode 100644 src/plugin/Daily.php create mode 100644 src/plugin/DailyBag.php rename src/plugin/{Heart.php => DoubleHeart.php} (68%) delete mode 100644 src/plugin/GameMatch.php create mode 100644 src/plugin/PolishTheMedal.php delete mode 100644 src/plugin/PolishTheMetal.php create mode 100644 src/plugin/VipPrivilege.php diff --git a/.gitignore b/.gitignore index dc788fa..418f31d 100644 --- a/.gitignore +++ b/.gitignore @@ -17,14 +17,14 @@ gen /configs/ /tests/ config -/conf/user*.conf +/conf/user*.ini *.log Traits/ README1.md -conf/user.conf -conf/user1.conf -/conf/user.conf -/conf/test.conf -/conf/test1.conf +conf/user.ini +conf/user1.ini +/conf/user.ini +/conf/test.ini +/conf/test1.ini /log/ /src/backup/ \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 87482ad..8b9aa3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,36 @@ # Release Notes + # 本项目Log +## v0.9.0.210517 alpha (2021-05-17) + +### Added + +- 重大更新 +- + +### Changed + +- 懒得写描述 +- + +### Fixed + +- 配置文件有变动 +- + +### Remarks + +- 请重新配置 +- + ## v0.8.1.210423 alpha (2021-04-23) ### Added - ### Changed + - 更新天选敏感词 - 更新活动列表 - 优化直播间心跳 @@ -21,12 +45,14 @@ ## v0.8.0.210327 alpha (2021-03-27) ### Added + - 增加直播扭蛋抽奖活动(可自定义) - 增加主站九宫格抽奖活动(可自定义) - 增加多个推送消息通道 - ### Changed + - 更新过滤词独立 - 更新请求中心 - 更新日志打印 @@ -43,13 +69,15 @@ - ### Fixed + - 修复小心心心跳错误 - 修复部分推送错误 - 修复银瓜子换银币日志错误 - ### Remarks -- 结构大更新,务必进行Composer等操作 + +- 结构大更新,务必进行Composer等操作 - ## v0.6.7.201117 alpha (2020-11-17) @@ -58,6 +86,7 @@ - ### Changed + - 调整WS读取数据大小 - 调整弹幕发送时间 - 更新天选之子日志打印 @@ -65,52 +94,61 @@ - ### Fixed + - 修复小心心心跳错误 -- +- ## v0.6.5.200808 alpha (2020-08-08) ### Added + - 添加小心心支持 - 添加活动抽奖 - ### Changed + - 去掉无效双端观看 - 过期小心心赠送 ### Fixed + - 修复小心心心跳错误 - ## v0.6.0.200730 alpha (2020-07-30) ### Added + - 添加小心心支持 -- +- ### Changed + - 更新天选过滤关键词 - ### Fixed + - 修复节奏风暴逻辑错误 - ## v0.5.0.200625 alpha (2020-06-25) ### Added + - 添加破产机(赔到破产) - 添加推送KEY到期通知 - 添加天选自动取关(测试) - 添加收益统计 - 添加关注投币模式 -- +- ### Changed + - 更新部分信息输出 - 修改日志打印前缀 -- 更新活跃弹幕延迟 +- 更新活跃弹幕延迟 - 重构部分统计代码 - 更新视频投币逻辑 - 更新实物抽奖API @@ -119,10 +157,11 @@ - ### Fixed + - 修复日志输出错误 - 修复每日送礼异常 - 修复赛事逻辑错误 -- 修复部分已知问题 +- 修复部分已知问题 - ## v0.4.0.200505 alpha (2020-05-05) @@ -131,15 +170,17 @@ - ### Changed + - 关闭已结束的LPL赛事任务 - ### Fixed + - 修复日志回调空格解析异常 - 修复节奏风暴回显过滤错误 - 修复活动抽奖重复请求问题 - 修复主站任务获取AID异常 -- +- ## v0.4.0.200428 alpha (2020-04-28) @@ -150,49 +191,58 @@ - ### Fixed + - 修复赠送礼物逻辑 - ## v0.4.0.200426 alpha (2020-04-26) ### Added + - 赛事助手 (签到、分享) -- +- ### Changed - ### Fixed + - 修复休眠机制 - ## v0.3.0.200425 alpha (2020-04-25) ### Added + - 添加调用函数 - ### Changed + - 取消一处请求头 - ### Fixed + - 修复休眠机制 - ## v0.3.0.200424 alpha (2020-04-24) ### Added + - 抽出独立小黑屋 - 提前引入BV2AV - ### Changed + - 优化监控推送 - 优化登录参数 - 同步黑屋提醒 ### Fixed + - 修复监控输出 - @@ -205,6 +255,7 @@ - ### Fixed + - 修复节奏风暴回显 - 修复分区监控异常 - 修复获取勋章异常 @@ -216,10 +267,12 @@ - ### Changed + - 去除主监控 - ### Fixed + - 修复风暴回显过滤 - 修复一处舰长处理 - 修复中奖记录通知 @@ -236,6 +289,7 @@ - ### Fixed + - 修复备用监控无法获取 - 修复获取分区ID异常 - @@ -243,6 +297,7 @@ ## v0.3.0.200404 alpha (2020-04-04) ### Added + - 添加ISSUE模板 - 添加处理监控端命令 - @@ -251,6 +306,7 @@ - ### Fixed + - 修复主监控内存溢出 - 修复活动礼物提醒 - @@ -258,10 +314,12 @@ ## v0.3.0.200318 alpha (2020-03-18) ### Added + - 添加日常任务定时执行(AM10:00) -- +- ### Changed + - Sleep->Schedule - 优化异常通知 - 优化异常重试数 @@ -270,6 +328,7 @@ - ### Fixed + - 修复日志回调 - 修复response为null - 修复PC端心跳 @@ -279,13 +338,15 @@ ## v0.3.0.200316 alpha (2020-03-16) ### Added + - 添加异常处理(通知) -- +- ### Changed - ### Fixed + - 修复活跃弹幕 - 修复风纪测试 - 修复部分已知 @@ -294,16 +355,19 @@ ## v0.3.0.200312 alpha (2020-03-12) ### Added + - 引入风纪 (不稳定测试) - 引入新库 (需要重新Composer) -- +- ### Changed + - 重构部分公用方法 - 重构CURL请求 - ### Fixed + - 修复登录繁忙 - 修复实物抽奖 - 修复日志输出 @@ -319,18 +383,21 @@ - ### Fixed + - 修复节奏风暴 - 修复双端心跳 -- +- ## v0.2.0.200224 alpha (2020-02-24) ### Added + - 新增工具类 - 引入新库(需要重新Composer) -- +- ### Changed + - 优化数据过滤条件 - 更新PC端心跳API - 优化实物抽奖 @@ -338,9 +405,10 @@ - ### Fixed + - 修复内存异常 - 修复重复投币 -- +- ## v0.2.0.200214 alpha (2020-02-14) @@ -348,10 +416,12 @@ - ### Changed + - 优化实物抽奖流程 - 优化延迟礼物抽奖 ### Fixed + - 修正部分函数名称 - 尝试减少静态占用 - @@ -359,20 +429,24 @@ ## v0.2.0.200208 alpha (2020-02-08) ### Added + - 哔哩哔哩漫画助手(可选) - ### Changed + - 补充部分过滤关键字 - ### Fixed + - 修复一处内存异常 - ## v0.1.0.200111 alpha (2020-01-11) ### Added + - 天选时刻奖品过滤 - @@ -385,6 +459,7 @@ ## v0.1.0.200128 alpha (2020-01-28) ### Added + - 增加推送消息过滤 - @@ -392,12 +467,14 @@ - ### Fixed + - 修复抽奖推送错误 - ## v0.1.0.200111 alpha (2020-01-11) ### Added + - 天选时刻奖品过滤 - @@ -410,40 +487,47 @@ ## v0.1.0.200103 alpha (2020-01-03) ### Added + - 增加并发请求 - ### Changed + - 更新抽奖逻辑 - 更新部分API - 减少重复请求 - ### Fixed + - 修复部分回显错误 - ## v0.1.0.200101 alpha (2020-01-01) ### Added + - 任务逻辑引入协程 ### Changed - ### Fixed + - 修复礼物赠送异常 - ## v0.1.0.191227 alpha (2019-12-27) ### Added + - 新增备用官方分区监控 - 新增按勋章亲密度赠送 - 新增天选时刻获奖推送 - ### Changed + - 优化部分架构 - 优化独立监控 - 优化监控逻辑 @@ -453,6 +537,7 @@ - ### Fixed + - 修复部分日志显示 - 修复数据统计异常 - 修复瓜子宝箱异常 @@ -462,7 +547,7 @@ - 修复部分已知BUG - 修复获奖推送通知 - 修复休眠中心异常 -- 修复礼物赠送异常 +- 修复礼物赠送异常 - ## v0.0.5.191223 alpha (2019-12-23) diff --git a/DOC.md b/DOC.md index 85879fc..b0cf7eb 100644 --- a/DOC.md +++ b/DOC.md @@ -1,68 +1,8 @@ - -

-
-
-
++ cnpkg(全量镜像)
+```bash
# 使用帮助
-https://mirrors.cloud.tencent.com/composer/
+> https://php.cnpkg.org/
# 使用命令
-composer config -g repos.packagist composer https://mirrors.cloud.tencent.com/composer/
+> composer config -g repos.packagist composer https://php.cnpkg.org
```
++ 腾讯云(全量镜像)
+```bash
+# 使用帮助
+> https://mirrors.cloud.tencent.com/help/composer.html
+# 使用命令
+> composer config -g repos.packagist composer https://mirrors.cloud.tencent.com/composer/
+```
+
++ phpcomposer(全量镜像)
+
+```bash
+# 使用帮助
+> https://pkg.phpcomposer.com/
+# 使用命令
+> composer config -g repo.packagist composer https://packagist.phpcomposer.com
+```
+
++ 华为云(全量镜像)
+
+```bash
+# 使用帮助
+> https://mirrors.huaweicloud.com/repository/php/
+# 使用命令
+> composer config -g repos.packagist composer https://mirrors.huaweicloud.com/repository/php/
+```
+
++ 交通大学(非全量镜像)
+
+```bash
+# 使用帮助
+> https://packagist.mirrors.sjtug.sjtu.edu.cn/
+# 使用命令
+> composer config -g repos.packagist composer https://packagist.mirrors.sjtug.sjtu.edu.cn
+```
+
+
+

+
+
+
+
+
+
+
-
+
@@ -28,53 +28,53 @@
## 功能组件
-> 以下任务都是按设定周期自动执行,`true`为正常使用,`false`为暂停使用或抛弃。
+以下任务都是按设定周期自动执行,`true`为正常使用,`false`为暂停使用或抛弃。
| plugin | status | version | description |
|-----------------|--------|----------|---------------------------------------------|
-| CheckUpdate | true | 21.05.17 | 程序检查更新 |
-| Login | true | 21.05.17 | 账号登录、刷新、维持 |
-| Schedule | true | 21.05.17 | 控制插件运行周期 |
-| MainSite | true | 21.05.17 | 投币、观看、分享视频 (速升6级不是梦) |
-| DailyBag | true | 21.05.17 | 双端领取日常/周常礼包 |
-| ManGa | true | 21.05.17 | 漫画签到、分享 |
-| ActivityLottery | true | 21.05.17 | 主站活动九宫格抽奖 |
-| Competition | true | 21.05.17 | 游戏赛事竞猜 |
-| DoubleHeart | true | 21.05.17 | 双端心跳 (姥爷直播经验) |
-| DailyTask | true | 21.05.17 | 直播每日任务(签到、观看) |
-| Barrage | true | 21.05.17 | 保持活跃弹幕 |
-| Silver2Coin | true | 21.05.17 | 银瓜子兑换硬币 |
-| Judge | true | 21.05.17 | 风纪委员投票 |
-| GiftSend | true | 21.05.17 | 礼物赠送、维持每日勋章亲密度 |
-| GroupSignIn | true | 21.05.17 | 友爱社签到 |
-| GiftHeart | true | 21.05.17 | 日常心跳每日礼包礼物 |
-| SmallHeart | true | 21.05.17 | 直播挂机,每日24个小心心 |
-| MaterialObject | true | 21.05.17 | 直播金色宝箱实物抽奖 |
-| AloneTcpClient | true | 21.05.17 | 作者的独立直播监控 |
-| ZoneTcpClient | true | 21.05.17 | 官方的分区直播监控 |
-| StormRaffle | true | 21.05.17 | 直播节奏风暴抽奖、亿元 |
-| GiftRaffle | true | 21.05.17 | 直播礼物抽奖 |
-| PkRaffle | true | 21.05.17 | 直播大乱斗抽奖 |
-| GuardRaffle | true | 21.05.17 | 直播大航海抽奖 |
-| AnchorRaffle | true | 21.05.17 | 直播天选时刻抽奖 |
-| GiftRaffle | true | 21.05.17 | 直播礼物抽奖 |
-| AwardRecord | true | 21.05.17 | 最新的中奖纪录通知 |
-| Forward | true | 21.05.17 | 主站动态抽奖转发 |
-| CapsuleLottery | true | 21.05.17 | 直播扭蛋活动抽奖 |
-| PolishTheMedal | true | 21.05.17 | 每日自动点亮灰色勋章 |
-| CapsuleLottery | true | 21.05.17 | 直播扭蛋活动抽奖 |
-| VipPrivilege | true | 21.05.17 | 每月领取年度大会员特权(B币券、会员购优惠券) |
-| BpConsumption | true | 21.05.17 | 每月消费使用年度大会员特权的B币券 |
-| Statistics | true | 21.05.17 | 全局抽奖结果统计 |
+| CheckUpdate | true | 21.05.18 | 程序检查更新 |
+| Login | true | 21.05.18 | 账号登录、刷新、维持 |
+| Schedule | true | 21.05.18 | 控制插件运行周期 |
+| MainSite | true | 21.05.18 | 投币、观看、分享视频 (速升6级不是梦) |
+| DailyBag | true | 21.05.18 | 双端领取日常/周常礼包 |
+| ManGa | true | 21.05.18 | 漫画签到、分享 |
+| ActivityLottery | true | 21.05.18 | 主站活动九宫格抽奖 |
+| Competition | true | 21.05.18 | 游戏赛事竞猜 |
+| DoubleHeart | true | 21.05.18 | 双端心跳 (姥爷直播经验) |
+| DailyTask | true | 21.05.18 | 直播每日任务(签到、观看) |
+| Barrage | true | 21.05.18 | 保持活跃弹幕 |
+| Silver2Coin | true | 21.05.18 | 银瓜子兑换硬币 |
+| Judge | true | 21.05.18 | 风纪委员投票 |
+| GiftSend | true | 21.05.18 | 礼物赠送、维持每日勋章亲密度 |
+| GroupSignIn | true | 21.05.18 | 友爱社签到 |
+| GiftHeart | true | 21.05.18 | 日常心跳每日礼包礼物 |
+| SmallHeart | true | 21.05.18 | 直播挂机,每日24个小心心 |
+| MaterialObject | true | 21.05.18 | 直播金色宝箱实物抽奖 |
+| AloneTcpClient | true | 21.05.18 | 作者的独立直播监控 |
+| ZoneTcpClient | true | 21.05.18 | 官方的分区直播监控 |
+| StormRaffle | true | 21.05.18 | 直播节奏风暴抽奖、亿元 |
+| GiftRaffle | true | 21.05.18 | 直播礼物抽奖 |
+| PkRaffle | true | 21.05.18 | 直播大乱斗抽奖 |
+| GuardRaffle | true | 21.05.18 | 直播大航海抽奖 |
+| AnchorRaffle | true | 21.05.18 | 直播天选时刻抽奖 |
+| GiftRaffle | true | 21.05.18 | 直播礼物抽奖 |
+| AwardRecord | true | 21.05.18 | 最新的中奖纪录通知 |
+| Forward | true | 21.05.18 | 主站动态抽奖转发 |
+| CapsuleLottery | true | 21.05.18 | 直播扭蛋活动抽奖 |
+| PolishTheMedal | true | 21.05.18 | 每日自动点亮灰色勋章 |
+| CapsuleLottery | true | 21.05.18 | 直播扭蛋活动抽奖 |
+| VipPrivilege | true | 21.05.18 | 每月领取年度大会员特权(B币券、会员购优惠券) |
+| BpConsumption | true | 21.05.18 | 每月消费使用年度大会员特权的B币券 |
+| Statistics | true | 21.05.18 | 全局抽奖结果统计 |
| Silver | false | 21.03.27 | 直播银瓜子自动开启宝箱 |
## 交流反馈
-> Group: [55308141](https://jq.qq.com/?_wv=1027&k=5AIDaJg) | **请不要来问如何使用, 文档齐全, 仅用于BUG提交反馈**
+Group: [55308141](https://jq.qq.com/?_wv=1027&k=5AIDaJg) | **请不要来问如何使用, 文档齐全, 仅用于BUG提交反馈**
## 相关文档
-> 有疑问一定要先看看文档或Issue里是否存在相同的问题,再考虑其他渠道咨询。
+有疑问一定要先看看文档或Issue里是否存在相同的问题,再考虑其他渠道咨询。
* [使用文档 / DOC.md](./DOC.md)
* [更新日志 / CHANGELOG.md](./CHANGELOG.md)
@@ -83,15 +83,19 @@
## 打赏支持
-> 如果觉得本项目好用,对你有所帮助,欢迎打赏支持。
+如果觉得本项目好用,对你有所帮助,欢迎打赏支持本项目哦。
-
+














+
+
## License 许可证
BiliHelper is under the MIT license.
diff --git a/data/activity_infos.json b/data/activity_infos.json
index 9b768d8..832be33 100644
--- a/data/activity_infos.json
+++ b/data/activity_infos.json
@@ -76,5 +76,17 @@
"draw_times": 1,
"expire_at": "2021-06-15 23:59:59"
}
+ ,
+ {
+ "url": "https://www.bilibili.com/blackboard/topic/activity-natsume.html",
+ "title": "夏目友人帐新作动画有奖预约页",
+ "description": "活动期间每天分享页面,新增一次机会。",
+ "sid": "a213c0b5-b6d4-11eb-8597-246e966235d8",
+ "login": "true",
+ "follow": "false",
+ "share": "true",
+ "draw_times": 1,
+ "expire_at": "2021-06-15 23:59:59"
+ }
]
}
\ No newline at end of file
diff --git a/Dockerfile b/docker/Dockerfile
similarity index 69%
rename from Dockerfile
rename to docker/Dockerfile
index 52987b6..c8ed2d3 100644
--- a/Dockerfile
+++ b/docker/Dockerfile
@@ -1,9 +1,12 @@
FROM php:alpine
-MAINTAINER zsnmwy
-
+
@@ -37,40 +37,40 @@
| plugin | status | version | description |
|-----------------|--------|----------|---------------------------------------------|
-| CheckUpdate | true | 21.05.18 | 程序检查更新 |
-| Login | true | 21.05.18 | 账号登录、刷新、维持 |
-| Schedule | true | 21.05.18 | 控制插件运行周期 |
-| MainSite | true | 21.05.18 | 投币、观看、分享视频 (速升6级不是梦) |
-| DailyBag | true | 21.05.18 | 双端领取日常/周常礼包 |
-| ManGa | true | 21.05.18 | 漫画签到、分享 |
-| ActivityLottery | true | 21.05.18 | 主站活动九宫格抽奖 |
-| Competition | true | 21.05.18 | 游戏赛事竞猜 |
-| DoubleHeart | true | 21.05.18 | 双端心跳 (姥爷直播经验) |
-| DailyTask | true | 21.05.18 | 直播每日任务(签到、观看) |
-| Barrage | true | 21.05.18 | 保持活跃弹幕 |
-| Silver2Coin | true | 21.05.18 | 银瓜子兑换硬币 |
-| Judge | true | 21.05.18 | 风纪委员投票 |
-| GiftSend | true | 21.05.18 | 礼物赠送、维持每日勋章亲密度 |
-| GroupSignIn | true | 21.05.18 | 友爱社签到 |
-| GiftHeart | true | 21.05.18 | 日常心跳每日礼包礼物 |
-| SmallHeart | true | 21.05.18 | 直播挂机,每日24个小心心 |
-| MaterialObject | true | 21.05.18 | 直播金色宝箱实物抽奖 |
-| AloneTcpClient | true | 21.05.18 | 作者的独立直播监控(可支持本项目哦) |
-| ZoneTcpClient | true | 21.05.18 | 官方的分区直播监控 |
-| StormRaffle | true | 21.05.18 | 直播节奏风暴抽奖、亿元 |
-| GiftRaffle | true | 21.05.18 | 直播礼物抽奖 |
-| PkRaffle | true | 21.05.18 | 直播大乱斗抽奖 |
-| GuardRaffle | true | 21.05.18 | 直播大航海抽奖 |
-| AnchorRaffle | true | 21.05.18 | 直播天选时刻抽奖 |
-| GiftRaffle | true | 21.05.18 | 直播礼物抽奖 |
-| AwardRecord | true | 21.05.18 | 最新的中奖纪录通知 |
-| Forward | true | 21.05.18 | 主站动态抽奖转发 |
-| CapsuleLottery | true | 21.05.18 | 直播扭蛋活动抽奖 |
-| PolishTheMedal | true | 21.05.18 | 每日自动点亮灰色勋章 |
-| CapsuleLottery | true | 21.05.18 | 直播扭蛋活动抽奖 |
-| VipPrivilege | true | 21.05.18 | 每月领取年度大会员特权(B币券、会员购优惠券) |
-| BpConsumption | true | 21.05.18 | 每月消费使用年度大会员特权的B币券 |
-| Statistics | true | 21.05.18 | 全局抽奖结果统计 |
+| CheckUpdate | true | 21.06.02 | 程序检查更新 |
+| Login | true | 21.06.02 | 账号登录、刷新、维持 |
+| Schedule | true | 21.06.02 | 控制插件运行周期 |
+| MainSite | true | 21.06.02 | 投币、观看、分享视频 (速升6级不是梦) |
+| DailyBag | true | 21.06.02 | 双端领取日常/周常礼包 |
+| ManGa | true | 21.06.02 | 漫画签到、分享 |
+| ActivityLottery | true | 21.06.02 | 主站活动九宫格抽奖 |
+| Competition | true | 21.06.02 | 游戏赛事竞猜 |
+| DoubleHeart | true | 21.06.02 | 双端心跳 (姥爷直播经验) |
+| DailyTask | true | 21.06.02 | 直播每日任务(签到、观看) |
+| Barrage | true | 21.06.02 | 保持活跃弹幕 |
+| Silver2Coin | true | 21.06.02 | 银瓜子兑换硬币 |
+| Judge | true | 21.06.02 | 风纪委员投票 |
+| GiftSend | true | 21.06.02 | 礼物赠送、维持每日勋章亲密度 |
+| GroupSignIn | true | 21.06.02 | 友爱社签到 |
+| GiftHeart | true | 21.06.02 | 日常心跳每日礼包礼物 |
+| SmallHeart | true | 21.06.02 | 直播挂机,每日24个小心心 |
+| MaterialObject | true | 21.06.02 | 直播金色宝箱实物抽奖 |
+| AloneTcpClient | true | 21.06.02 | 作者的独立直播监控(可支持本项目哦) |
+| ZoneTcpClient | true | 21.06.02 | 官方的分区直播监控 |
+| StormRaffle | true | 21.06.02 | 直播节奏风暴抽奖、亿元 |
+| GiftRaffle | true | 21.06.02 | 直播礼物抽奖 |
+| PkRaffle | true | 21.06.02 | 直播大乱斗抽奖 |
+| GuardRaffle | true | 21.06.02 | 直播大航海抽奖 |
+| AnchorRaffle | true | 21.06.02 | 直播天选时刻抽奖 |
+| GiftRaffle | true | 21.06.02 | 直播礼物抽奖 |
+| AwardRecord | true | 21.06.02 | 最新的中奖纪录通知 |
+| Forward | true | 21.06.02 | 主站动态抽奖转发 |
+| CapsuleLottery | true | 21.06.02 | 直播扭蛋活动抽奖 |
+| PolishTheMedal | true | 21.06.02 | 每日自动点亮灰色勋章 |
+| CapsuleLottery | true | 21.06.02 | 直播扭蛋活动抽奖 |
+| VipPrivilege | true | 21.06.02 | 每月领取年度大会员特权(B币券、会员购优惠券) |
+| BpConsumption | true | 21.06.02 | 每月消费使用年度大会员特权的B币券 |
+| Statistics | true | 21.06.02 | 全局抽奖结果统计 |
| Silver | false | 21.03.27 | 直播银瓜子自动开启宝箱 |
## 交流反馈
diff --git a/data/latest_version.json b/data/latest_version.json
index c7dc9b6..6c97590 100644
--- a/data/latest_version.json
+++ b/data/latest_version.json
@@ -5,7 +5,7 @@
"source": "https://github.com/lkeme/BiliHelper-personal",
"raw_url": "https://cdn.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest_version.json",
"purge_url": "https://purge.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest_version.json",
- "version": "0.9.1.210518",
+ "version": "0.9.2.210602",
"des": "程序有更新,请及时线上查看更新哦~",
- "time": "2021年5月18日18:31:03"
+ "time": "2021年6月2日21:40:35"
}
\ No newline at end of file
From ad3263da30f4e26bde526252a5f30894eac62581 Mon Sep 17 00:00:00 2001
From: Lkeme <19500576+lkeme@users.noreply.github.com>
Date: Wed, 2 Jun 2021 21:53:14 +0800
Subject: [PATCH 15/28] [update] DockerFile
---
.github/workflows/build_image_bhp.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/build_image_bhp.yml b/.github/workflows/build_image_bhp.yml
index 632999c..1bf3977 100644
--- a/.github/workflows/build_image_bhp.yml
+++ b/.github/workflows/build_image_bhp.yml
@@ -15,7 +15,8 @@ jobs:
publish: true
imageName: lkeme/bilihelper-personal
dockerFile: docker/Dockerfile
- platform: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8
+ platform: linux/amd64,linux/arm64,linux/arm/v7
+ # platform: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8
tag: latest
dockerUser: ${{ secrets.DOCKER_USERNAME }}
dockerPassword: ${{ secrets.DOCKER_PASSWORD }}
\ No newline at end of file
From 9402ab35f5f62900024aad4fff6c06b7502107a1 Mon Sep 17 00:00:00 2001
From: 0x012FA733 <49284128+0x012FA733@users.noreply.github.com>
Date: Thu, 3 Jun 2021 18:19:09 +0800
Subject: [PATCH 16/28] [update] GroupSignIn
---
src/plugin/GroupSignIn.php | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/plugin/GroupSignIn.php b/src/plugin/GroupSignIn.php
index 6247abb..91f9408 100644
--- a/src/plugin/GroupSignIn.php
+++ b/src/plugin/GroupSignIn.php
@@ -72,8 +72,13 @@ class GroupSignIn
if ($de_raw['code'] != '0') {
// TODO 任务失败原因
- print_r($de_raw);
- Log::warning('在应援团{' . $groupInfo['group_name'] . '}中签到失败, 原因待查');
+ // {"code": 710001, "msg": "应援失败>_<", "message": "应援失败>_<", "ttl": "1", "data": {"add_num": 0, "status": 0}}
+ if ($de_raw['code'] == '710001') {
+ Log::warning('在应援团{' . $groupInfo['group_name'] . '}中签到失败, 亲密度已达上限');
+ } else {
+ print_r($de_raw);
+ Log::warning('在应援团{' . $groupInfo['group_name'] . '}中签到失败, 原因待查');
+ }
return false;
}
if ($de_raw['data']['status'] == '0') {
From b77940801d6f8985175b73e401ca62ed0b7f1579 Mon Sep 17 00:00:00 2001
From: Lkeme <19500576+lkeme@users.noreply.github.com>
Date: Wed, 16 Jun 2021 17:26:26 +0800
Subject: [PATCH 17/28] [add] Task
---
.gitignore | 9 +-
CHANGELOG.md | 24 ++-
README.md | 70 ++++----
composer.json | 1 -
composer.lock | 302 ++++------------------------------
src/core/App.php | 1 +
src/core/Config.php | 111 +++++++------
src/core/Curl.php | 2 +-
src/core/Task.php | 104 ++++++++++++
src/plugin/AloneTcpClient.php | 6 +-
src/plugin/Barrage.php | 2 +-
src/plugin/GiftSend.php | 4 +-
src/plugin/Sign.php | 4 +-
src/util/TimeLock.php | 16 +-
task/.gitkeep | 0
15 files changed, 286 insertions(+), 370 deletions(-)
create mode 100644 src/core/Task.php
create mode 100644 task/.gitkeep
diff --git a/.gitignore b/.gitignore
index 418f31d..c598a49 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,4 +27,11 @@ conf/user1.ini
/conf/test.ini
/conf/test1.ini
/log/
-/src/backup/
\ No newline at end of file
+/src/backup/
+
+# ignore all files in lib/
+task/*
+# except for .gitkeep
+!.gitkeep
+# ignore TODO file in root directory,not subdir/TODO
+/TODO
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ab65e2f..8fc3c1d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,28 @@
# 本项目Log
+## v0.9.3.210616 alpha (2021-06-16)
+
+### Added
+
+- 任务排程
+-
+
+### Changed
+
+- 配置热更新
+-
+
+### Fixed
+
+- 修复弹幕
+- 修复独立监控
+-
+
+### Remarks
+
+-
+
## v0.9.2.210602 alpha (2021-06-02)
### Added
@@ -20,7 +42,7 @@
### Remarks
---
+-
## v0.9.1.210518 alpha (2021-05-18)
diff --git a/README.md b/README.md
index 961e752..78edf41 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@
-
+
@@ -37,40 +37,40 @@
| plugin | status | version | description |
|-----------------|--------|----------|---------------------------------------------|
-| CheckUpdate | true | 21.06.02 | 程序检查更新 |
-| Login | true | 21.06.02 | 账号登录、刷新、维持 |
-| Schedule | true | 21.06.02 | 控制插件运行周期 |
-| MainSite | true | 21.06.02 | 投币、观看、分享视频 (速升6级不是梦) |
-| DailyBag | true | 21.06.02 | 双端领取日常/周常礼包 |
-| ManGa | true | 21.06.02 | 漫画签到、分享 |
-| ActivityLottery | true | 21.06.02 | 主站活动九宫格抽奖 |
-| Competition | true | 21.06.02 | 游戏赛事竞猜 |
-| DoubleHeart | true | 21.06.02 | 双端心跳 (姥爷直播经验) |
-| DailyTask | true | 21.06.02 | 直播每日任务(签到、观看) |
-| Barrage | true | 21.06.02 | 保持活跃弹幕 |
-| Silver2Coin | true | 21.06.02 | 银瓜子兑换硬币 |
-| Judge | true | 21.06.02 | 风纪委员投票 |
-| GiftSend | true | 21.06.02 | 礼物赠送、维持每日勋章亲密度 |
-| GroupSignIn | true | 21.06.02 | 友爱社签到 |
-| GiftHeart | true | 21.06.02 | 日常心跳每日礼包礼物 |
-| SmallHeart | true | 21.06.02 | 直播挂机,每日24个小心心 |
-| MaterialObject | true | 21.06.02 | 直播金色宝箱实物抽奖 |
-| AloneTcpClient | true | 21.06.02 | 作者的独立直播监控(可支持本项目哦) |
-| ZoneTcpClient | true | 21.06.02 | 官方的分区直播监控 |
-| StormRaffle | true | 21.06.02 | 直播节奏风暴抽奖、亿元 |
-| GiftRaffle | true | 21.06.02 | 直播礼物抽奖 |
-| PkRaffle | true | 21.06.02 | 直播大乱斗抽奖 |
-| GuardRaffle | true | 21.06.02 | 直播大航海抽奖 |
-| AnchorRaffle | true | 21.06.02 | 直播天选时刻抽奖 |
-| GiftRaffle | true | 21.06.02 | 直播礼物抽奖 |
-| AwardRecord | true | 21.06.02 | 最新的中奖纪录通知 |
-| Forward | true | 21.06.02 | 主站动态抽奖转发 |
-| CapsuleLottery | true | 21.06.02 | 直播扭蛋活动抽奖 |
-| PolishTheMedal | true | 21.06.02 | 每日自动点亮灰色勋章 |
-| CapsuleLottery | true | 21.06.02 | 直播扭蛋活动抽奖 |
-| VipPrivilege | true | 21.06.02 | 每月领取年度大会员特权(B币券、会员购优惠券) |
-| BpConsumption | true | 21.06.02 | 每月消费使用年度大会员特权的B币券 |
-| Statistics | true | 21.06.02 | 全局抽奖结果统计 |
+| CheckUpdate | true | 21.06.16 | 程序检查更新 |
+| Login | true | 21.06.16 | 账号登录、刷新、维持 |
+| Schedule | true | 21.06.16 | 控制插件运行周期 |
+| MainSite | true | 21.06.16 | 投币、观看、分享视频 (速升6级不是梦) |
+| DailyBag | true | 21.06.16 | 双端领取日常/周常礼包 |
+| ManGa | true | 21.06.16 | 漫画签到、分享 |
+| ActivityLottery | true | 21.06.16 | 主站活动九宫格抽奖 |
+| Competition | true | 21.06.16 | 游戏赛事竞猜 |
+| DoubleHeart | true | 21.06.16 | 双端心跳 (姥爷直播经验) |
+| DailyTask | true | 21.06.16 | 直播每日任务(签到、观看) |
+| Barrage | true | 21.06.16 | 保持活跃弹幕 |
+| Silver2Coin | true | 21.06.16 | 银瓜子兑换硬币 |
+| Judge | true | 21.06.16 | 风纪委员投票 |
+| GiftSend | true | 21.06.16 | 礼物赠送、维持每日勋章亲密度 |
+| GroupSignIn | true | 21.06.16 | 友爱社签到 |
+| GiftHeart | true | 21.06.16 | 日常心跳每日礼包礼物 |
+| SmallHeart | true | 21.06.16 | 直播挂机,每日24个小心心 |
+| MaterialObject | true | 21.06.16 | 直播金色宝箱实物抽奖 |
+| AloneTcpClient | true | 21.06.16 | 作者的独立直播监控(可支持本项目哦) |
+| ZoneTcpClient | true | 21.06.16 | 官方的分区直播监控 |
+| StormRaffle | true | 21.06.16 | 直播节奏风暴抽奖、亿元 |
+| GiftRaffle | true | 21.06.16 | 直播礼物抽奖 |
+| PkRaffle | true | 21.06.16 | 直播大乱斗抽奖 |
+| GuardRaffle | true | 21.06.16 | 直播大航海抽奖 |
+| AnchorRaffle | true | 21.06.16 | 直播天选时刻抽奖 |
+| GiftRaffle | true | 21.06.16 | 直播礼物抽奖 |
+| AwardRecord | true | 21.06.16 | 最新的中奖纪录通知 |
+| Forward | true | 21.06.16 | 主站动态抽奖转发 |
+| CapsuleLottery | true | 21.06.16 | 直播扭蛋活动抽奖 |
+| PolishTheMedal | true | 21.06.16 | 每日自动点亮灰色勋章 |
+| CapsuleLottery | true | 21.06.16 | 直播扭蛋活动抽奖 |
+| VipPrivilege | true | 21.06.16 | 每月领取年度大会员特权(B币券、会员购优惠券) |
+| BpConsumption | true | 21.06.16 | 每月消费使用年度大会员特权的B币券 |
+| Statistics | true | 21.06.16 | 全局抽奖结果统计 |
| Silver | false | 21.03.27 | 直播银瓜子自动开启宝箱 |
## 交流反馈
diff --git a/composer.json b/composer.json
index f1a7956..05d380a 100644
--- a/composer.json
+++ b/composer.json
@@ -13,7 +13,6 @@
"monolog/monolog": "^1.26.0",
"bramus/monolog-colored-line-formatter": "^2.0.3",
"clue/socket-raw": "^1.5.0",
- "vlucas/phpdotenv": "^4.2.0",
"amphp/amp": "^2.5.2",
"guzzlehttp/guzzle": "^6.5.5",
"mathieuviossat/arraytotexttable": "^1.0.8",
diff --git a/composer.lock b/composer.lock
index 62f4a6e..8deaef9 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "e70802004e3c9d66674b79cba60e91ad",
+ "content-hash": "224c6b1ce9f6f5220d3de9434a44da42",
"packages": [
{
"name": "amphp/amp",
@@ -1081,16 +1081,16 @@
},
{
"name": "monolog/monolog",
- "version": "1.26.0",
+ "version": "1.26.1",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
- "reference": "2209ddd84e7ef1256b7af205d0717fb62cfc9c33"
+ "reference": "c6b00f05152ae2c9b04a448f99c7590beb6042f5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Seldaek/monolog/zipball/2209ddd84e7ef1256b7af205d0717fb62cfc9c33",
- "reference": "2209ddd84e7ef1256b7af205d0717fb62cfc9c33",
+ "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c6b00f05152ae2c9b04a448f99c7590beb6042f5",
+ "reference": "c6b00f05152ae2c9b04a448f99c7590beb6042f5",
"shasum": "",
"mirrors": [
{
@@ -1157,7 +1157,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
- "source": "https://github.com/Seldaek/monolog/tree/1.26.0"
+ "source": "https://github.com/Seldaek/monolog/tree/1.26.1"
},
"funding": [
{
@@ -1169,82 +1169,7 @@
"type": "tidelift"
}
],
- "time": "2020-12-14T12:56:38+00:00"
- },
- {
- "name": "phpoption/phpoption",
- "version": "1.7.5",
- "source": {
- "type": "git",
- "url": "https://github.com/schmittjoh/php-option.git",
- "reference": "994ecccd8f3283ecf5ac33254543eb0ac946d525"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/994ecccd8f3283ecf5ac33254543eb0ac946d525",
- "reference": "994ecccd8f3283ecf5ac33254543eb0ac946d525",
- "shasum": "",
- "mirrors": [
- {
- "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
- "preferred": true
- }
- ]
- },
- "require": {
- "php": "^5.5.9 || ^7.0 || ^8.0"
- },
- "require-dev": {
- "bamarni/composer-bin-plugin": "^1.4.1",
- "phpunit/phpunit": "^4.8.35 || ^5.7.27 || ^6.5.6 || ^7.0 || ^8.0 || ^9.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.7-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "PhpOption\\": "src/PhpOption/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache-2.0"
- ],
- "authors": [
- {
- "name": "Johannes M. Schmitt",
- "email": "schmittjoh@gmail.com"
- },
- {
- "name": "Graham Campbell",
- "email": "graham@alt-three.com"
- }
- ],
- "description": "Option Type for PHP",
- "keywords": [
- "language",
- "option",
- "php",
- "type"
- ],
- "support": {
- "issues": "https://github.com/schmittjoh/php-option/issues",
- "source": "https://github.com/schmittjoh/php-option/tree/1.7.5"
- },
- "funding": [
- {
- "url": "https://github.com/GrahamCampbell",
- "type": "github"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption",
- "type": "tidelift"
- }
- ],
- "time": "2020-07-20T17:29:33+00:00"
+ "time": "2021-05-28T08:32:12+00:00"
},
{
"name": "psr/container",
@@ -1526,103 +1451,18 @@
},
"time": "2021-01-19T12:14:40+00:00"
},
- {
- "name": "symfony/polyfill-ctype",
- "version": "v1.22.1",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/polyfill-ctype.git",
- "reference": "c6c942b1ac76c82448322025e084cadc56048b4e"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e",
- "reference": "c6c942b1ac76c82448322025e084cadc56048b4e",
- "shasum": "",
- "mirrors": [
- {
- "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
- "preferred": true
- }
- ]
- },
- "require": {
- "php": ">=7.1"
- },
- "suggest": {
- "ext-ctype": "For best performance"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-main": "1.22-dev"
- },
- "thanks": {
- "name": "symfony/polyfill",
- "url": "https://github.com/symfony/polyfill"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Polyfill\\Ctype\\": ""
- },
- "files": [
- "bootstrap.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Gert de Pagter",
- "email": "BackEndTea@gmail.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony polyfill for ctype functions",
- "homepage": "https://symfony.com",
- "keywords": [
- "compatibility",
- "ctype",
- "polyfill",
- "portable"
- ],
- "support": {
- "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1"
- },
- "funding": [
- {
- "url": "https://symfony.com/sponsor",
- "type": "custom"
- },
- {
- "url": "https://github.com/fabpot",
- "type": "github"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
- "type": "tidelift"
- }
- ],
- "time": "2021-01-07T16:49:33+00:00"
- },
{
"name": "symfony/polyfill-intl-idn",
- "version": "v1.22.1",
+ "version": "v1.23.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
- "reference": "2d63434d922daf7da8dd863e7907e67ee3031483"
+ "reference": "65bd267525e82759e7d8c4e8ceea44f398838e65"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/2d63434d922daf7da8dd863e7907e67ee3031483",
- "reference": "2d63434d922daf7da8dd863e7907e67ee3031483",
+ "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/65bd267525e82759e7d8c4e8ceea44f398838e65",
+ "reference": "65bd267525e82759e7d8c4e8ceea44f398838e65",
"shasum": "",
"mirrors": [
{
@@ -1642,7 +1482,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "1.22-dev"
+ "dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -1686,7 +1526,7 @@
"shim"
],
"support": {
- "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.22.1"
+ "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.23.0"
},
"funding": [
{
@@ -1702,20 +1542,20 @@
"type": "tidelift"
}
],
- "time": "2021-01-22T09:19:47+00:00"
+ "time": "2021-05-27T09:27:20+00:00"
},
{
"name": "symfony/polyfill-intl-normalizer",
- "version": "v1.22.1",
+ "version": "v1.23.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
- "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248"
+ "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/43a0283138253ed1d48d352ab6d0bdb3f809f248",
- "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248",
+ "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8",
+ "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8",
"shasum": "",
"mirrors": [
{
@@ -1733,7 +1573,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "1.22-dev"
+ "dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -1776,7 +1616,7 @@
"shim"
],
"support": {
- "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.1"
+ "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0"
},
"funding": [
{
@@ -1792,20 +1632,20 @@
"type": "tidelift"
}
],
- "time": "2021-01-22T09:19:47+00:00"
+ "time": "2021-02-19T12:13:01+00:00"
},
{
"name": "symfony/polyfill-php72",
- "version": "v1.22.1",
+ "version": "v1.23.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
- "reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9"
+ "reference": "9a142215a36a3888e30d0a9eeea9766764e96976"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9",
- "reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9",
+ "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976",
+ "reference": "9a142215a36a3888e30d0a9eeea9766764e96976",
"shasum": "",
"mirrors": [
{
@@ -1820,7 +1660,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "1.22-dev"
+ "dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -1858,7 +1698,7 @@
"shim"
],
"support": {
- "source": "https://github.com/symfony/polyfill-php72/tree/v1.22.1"
+ "source": "https://github.com/symfony/polyfill-php72/tree/v1.23.0"
},
"funding": [
{
@@ -1874,91 +1714,7 @@
"type": "tidelift"
}
],
- "time": "2021-01-07T16:49:33+00:00"
- },
- {
- "name": "vlucas/phpdotenv",
- "version": "v4.2.0",
- "source": {
- "type": "git",
- "url": "https://github.com/vlucas/phpdotenv.git",
- "reference": "da64796370fc4eb03cc277088f6fede9fde88482"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/da64796370fc4eb03cc277088f6fede9fde88482",
- "reference": "da64796370fc4eb03cc277088f6fede9fde88482",
- "shasum": "",
- "mirrors": [
- {
- "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
- "preferred": true
- }
- ]
- },
- "require": {
- "php": "^5.5.9 || ^7.0 || ^8.0",
- "phpoption/phpoption": "^1.7.3",
- "symfony/polyfill-ctype": "^1.17"
- },
- "require-dev": {
- "bamarni/composer-bin-plugin": "^1.4.1",
- "ext-filter": "*",
- "ext-pcre": "*",
- "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20"
- },
- "suggest": {
- "ext-filter": "Required to use the boolean validator.",
- "ext-pcre": "Required to use most of the library."
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "4.1-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Dotenv\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Graham Campbell",
- "email": "graham@alt-three.com",
- "homepage": "https://gjcampbell.co.uk/"
- },
- {
- "name": "Vance Lucas",
- "email": "vance@vancelucas.com",
- "homepage": "https://vancelucas.com/"
- }
- ],
- "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
- "keywords": [
- "dotenv",
- "env",
- "environment"
- ],
- "support": {
- "issues": "https://github.com/vlucas/phpdotenv/issues",
- "source": "https://github.com/vlucas/phpdotenv/tree/v4.2.0"
- },
- "funding": [
- {
- "url": "https://github.com/GrahamCampbell",
- "type": "github"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv",
- "type": "tidelift"
- }
- ],
- "time": "2021-01-20T15:11:48+00:00"
+ "time": "2021-05-27T09:17:38+00:00"
}
],
"packages-dev": [],
@@ -1977,5 +1733,5 @@
"ext-mbstring": "*"
},
"platform-dev": [],
- "plugin-api-version": "2.0.0"
+ "plugin-api-version": "2.1.0"
}
diff --git a/src/core/App.php b/src/core/App.php
index 1a8b1dd..25ccbae 100644
--- a/src/core/App.php
+++ b/src/core/App.php
@@ -24,6 +24,7 @@ class App
define('APP_CONF_PATH', $app_path . "/conf/");
define('APP_DATA_PATH', $app_path . "/data/");
define('APP_LOG_PATH', $app_path . "/log/");
+ define('APP_TASK_PATH', $app_path . "/task/");
}
/**
diff --git a/src/core/Config.php b/src/core/Config.php
index 7f9266f..627034c 100644
--- a/src/core/Config.php
+++ b/src/core/Config.php
@@ -15,8 +15,71 @@ use Jelix\IniFile\IniModifier;
class Config
{
private static $app_config;
+ private static $load_file;
+ private static $last_time;
+ private static $config_path;
private static $instance;
+ private static function getInstance(): Config
+ {
+ if (is_null(self::$instance)) {
+ self::$instance = new static;
+ }
+ return self::$instance;
+ }
+
+ /**
+ * @use 加载配置
+ * @param string $load_file
+ */
+ public static function load(string $load_file)
+ {
+ $config_path = str_replace("\\", "/", APP_CONF_PATH . $load_file);
+ if (!is_file($config_path)) {
+ die("配置文件 {$load_file} 加载错误,请参照文档添加配置文件!");
+ }
+ // 给静态参数赋值
+ self::$load_file = $load_file;
+ self::$config_path = $config_path;
+ // $config_path = dirname($config_path).DIRECTORY_SEPARATOR.$load_file;
+ self::$app_config = new IniModifier(self::$config_path);
+ self::$last_time = fileatime(self::$config_path);
+ }
+
+
+ public static function _set($name, $value, $section = 0, $key = null)
+ {
+ $_instance = self::getInstance();
+ $_instance::$app_config->setValue($name, $value, $section, $key);
+ $_instance::$app_config->save();
+ // 保存修改时间
+ $_instance::$last_time = fileatime($_instance::$config_path);
+ }
+
+ public static function _get($name, $section = 0, $key = null)
+ {
+ $_instance = self::getInstance();
+ // 判断是否被修改 重新加载文件
+ // echo $_instance::$last_time.PHP_EOL;
+ // echo fileatime($_instance::$config_path);
+ if (fileatime($_instance::$config_path) != $_instance::$last_time) {
+ $_instance::load($_instance::$load_file);
+ }
+ return $_instance::$app_config->getValue($name, $section, $key);
+ }
+
+ public static function _put()
+ {
+ $_instance = self::getInstance();
+
+ }
+
+ public static function _del()
+ {
+ $_instance = self::getInstance();
+
+ }
+
/**
* 不允许从外部调用以防止创建多个实例
* 要使用单例,必须通过 Singleton::getInstance() 方法获取实例
@@ -39,52 +102,4 @@ class Config
{
}
-
- private static function getInstance(): Config
- {
- if (is_null(self::$instance)) {
- self::$instance = new static;
- }
- return self::$instance;
- }
-
- /**
- * @use 加载配置
- * @param string $load_file
- */
- public static function load(string $load_file)
- {
- $config_path = str_replace("\\", "/", APP_CONF_PATH . $load_file);
- if (!is_file($config_path)) {
- die("配置文件 {$load_file} 加载错误,请参照文档添加配置文件!");
- }
- // $config_path = dirname($config_path).DIRECTORY_SEPARATOR.$load_file;
- self::$app_config = new IniModifier($config_path);
- }
-
-
- public static function _set($name, $value, $section = 0, $key = null)
- {
- $_instance = self::getInstance();
- $_instance::$app_config->setValue($name, $value, $section, $key);
- $_instance::$app_config->save();
- }
-
- public static function _get($name, $section = 0, $key = null)
- {
- $_instance = self::getInstance();
- return $_instance::$app_config->getValue($name, $section, $key);
- }
-
- public static function _put()
- {
- $_instance = self::getInstance();
-
- }
-
- public static function _del()
- {
- $_instance = self::getInstance();
-
- }
}
\ No newline at end of file
diff --git a/src/core/Curl.php b/src/core/Curl.php
index 6833b83..f1ac25a 100644
--- a/src/core/Curl.php
+++ b/src/core/Curl.php
@@ -243,7 +243,7 @@ class Curl
'Connection' => 'keep-alive',
// 'Content-Type' => 'application/x-www-form-urlencoded',
// 'User-Agent' => 'Mozilla/5.0 BiliDroid/5.51.1 (bbcallen@gmail.com)',
- 'User-Agent' => 'Mozilla/5.0 BiliDroid/6.25.0 (bbcallen@gmail.com) os/android model/MuMu mobi_app/android build/6250300 channel/bili innerVer/6250300 osVer/6.0.1 network/2',
+ 'User-Agent' => 'Mozilla/5.0 BiliDroid/6.28.0 (bbcallen@gmail.com) os/android model/MuMu mobi_app/android build/6280300 channel/bili innerVer/6280300 osVer/6.0.1 network/2',
// 'Referer' => 'https://live.bilibili.com/',
];
$pc_headers = [
diff --git a/src/core/Task.php b/src/core/Task.php
new file mode 100644
index 0000000..5f6a4b4
--- /dev/null
+++ b/src/core/Task.php
@@ -0,0 +1,104 @@
+ $data['message']]);
Log::warning('清空礼物功能禁用!');
- self::$lock = time() + 100000000;
+ self::setLock(100000000);
return;
}
self::$uid = $data['data']['uid'];
@@ -224,7 +224,7 @@ class GiftSend
if (isset($data['code']) && $data['code']) {
Log::warning('获取主播房间号失败!', ['msg' => $data['message']]);
Log::warning('清空礼物功能禁用!');
- self::$lock = time() + 100000000;
+ self::setLock(100000000);
return;
}
Log::info('直播间信息生成完毕!');
diff --git a/src/plugin/Sign.php b/src/plugin/Sign.php
index 2f4c4a3..cc245ea 100644
--- a/src/plugin/Sign.php
+++ b/src/plugin/Sign.php
@@ -55,7 +55,7 @@ class Sign
'access_key' => getConf('access_token', 'login.auth'),
'actionKey' => 'appkey',
'appkey' => $appkey,
- 'build' => 6250300,
+ 'build' => 6280300,
'channel' => 'bili',
'device' => 'phone',
'mobi_app' => 'android',
@@ -84,7 +84,7 @@ class Sign
'access_key' => getConf('access_token', 'login.auth'),
'actionKey' => 'appkey',
'appkey' => $appkey,
- 'build' => 6250300,
+ 'build' => 6280300,
'device' => 'phone',
'mobi_app' => 'android',
'platform' => 'android',
diff --git a/src/util/TimeLock.php b/src/util/TimeLock.php
index 19137e5..eace2fe 100644
--- a/src/util/TimeLock.php
+++ b/src/util/TimeLock.php
@@ -11,6 +11,7 @@
namespace BiliHelper\Util;
use Amp\Delayed;
+use BiliHelper\Core\Task;
use BiliHelper\Plugin\Schedule;
trait TimeLock
@@ -25,7 +26,7 @@ trait TimeLock
public static function setLock(int $lock)
{
if (!static::getpauseStatus()) {
- static::$lock = time() + $lock;
+ Task::getInstance()::_setLock(static::getBaseClass(), time() + $lock);
}
}
@@ -35,7 +36,16 @@ trait TimeLock
*/
public static function getLock(): int
{
- return static::$lock;
+ return Task::getInstance()::_getLock(static::getBaseClass());
+ }
+
+ /**
+ * @use 获取基础CLASS NAME
+ * @return string
+ */
+ public static function getBaseClass(): string
+ {
+ return basename(str_replace('\\', '/', __CLASS__));
}
/**
@@ -104,7 +114,7 @@ trait TimeLock
*/
public static function cancelPause()
{
- static::$lock = false;
+ static::$pause_status = false;
}
/**
diff --git a/task/.gitkeep b/task/.gitkeep
new file mode 100644
index 0000000..e69de29
From 7695c88817d90e7d0eeec0565f56a4a314286dcf Mon Sep 17 00:00:00 2001
From: Lkeme <19500576+lkeme@users.noreply.github.com>
Date: Wed, 23 Jun 2021 16:44:26 +0800
Subject: [PATCH 18/28] [fix] MainSite & Silver2Coin fixed #90
---
CHANGELOG.md | 22 ++++++++++++
README.md | 70 +++++++++++++++++++-------------------
data/activity_infos.json | 56 ------------------------------
data/capsule_infos.json | 17 +++++----
data/latest_version.json | 4 +--
src/core/App.php | 2 +-
src/plugin/Live.php | 4 +--
src/plugin/MainSite.php | 38 ++++++++++++++++++---
src/plugin/Silver2Coin.php | 39 ++++++++++++++++++---
9 files changed, 140 insertions(+), 112 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8fc3c1d..44e2b9f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,28 @@
# 本项目Log
+## v0.9.4.210623 alpha (2021-06-23)
+
+### Added
+
+-
+
+### Changed
+
+- 更新部分仓库文件
+-
+
+### Fixed
+
+- 修复PC端银瓜子兑换硬币
+- 修复主站投币任务
+- 修复点亮勋章特殊情况
+-
+
+### Remarks
+
+-
+
## v0.9.3.210616 alpha (2021-06-16)
### Added
diff --git a/README.md b/README.md
index 78edf41..43d2053 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@
-
+
@@ -37,40 +37,40 @@
| plugin | status | version | description |
|-----------------|--------|----------|---------------------------------------------|
-| CheckUpdate | true | 21.06.16 | 程序检查更新 |
-| Login | true | 21.06.16 | 账号登录、刷新、维持 |
-| Schedule | true | 21.06.16 | 控制插件运行周期 |
-| MainSite | true | 21.06.16 | 投币、观看、分享视频 (速升6级不是梦) |
-| DailyBag | true | 21.06.16 | 双端领取日常/周常礼包 |
-| ManGa | true | 21.06.16 | 漫画签到、分享 |
-| ActivityLottery | true | 21.06.16 | 主站活动九宫格抽奖 |
-| Competition | true | 21.06.16 | 游戏赛事竞猜 |
-| DoubleHeart | true | 21.06.16 | 双端心跳 (姥爷直播经验) |
-| DailyTask | true | 21.06.16 | 直播每日任务(签到、观看) |
-| Barrage | true | 21.06.16 | 保持活跃弹幕 |
-| Silver2Coin | true | 21.06.16 | 银瓜子兑换硬币 |
-| Judge | true | 21.06.16 | 风纪委员投票 |
-| GiftSend | true | 21.06.16 | 礼物赠送、维持每日勋章亲密度 |
-| GroupSignIn | true | 21.06.16 | 友爱社签到 |
-| GiftHeart | true | 21.06.16 | 日常心跳每日礼包礼物 |
-| SmallHeart | true | 21.06.16 | 直播挂机,每日24个小心心 |
-| MaterialObject | true | 21.06.16 | 直播金色宝箱实物抽奖 |
-| AloneTcpClient | true | 21.06.16 | 作者的独立直播监控(可支持本项目哦) |
-| ZoneTcpClient | true | 21.06.16 | 官方的分区直播监控 |
-| StormRaffle | true | 21.06.16 | 直播节奏风暴抽奖、亿元 |
-| GiftRaffle | true | 21.06.16 | 直播礼物抽奖 |
-| PkRaffle | true | 21.06.16 | 直播大乱斗抽奖 |
-| GuardRaffle | true | 21.06.16 | 直播大航海抽奖 |
-| AnchorRaffle | true | 21.06.16 | 直播天选时刻抽奖 |
-| GiftRaffle | true | 21.06.16 | 直播礼物抽奖 |
-| AwardRecord | true | 21.06.16 | 最新的中奖纪录通知 |
-| Forward | true | 21.06.16 | 主站动态抽奖转发 |
-| CapsuleLottery | true | 21.06.16 | 直播扭蛋活动抽奖 |
-| PolishTheMedal | true | 21.06.16 | 每日自动点亮灰色勋章 |
-| CapsuleLottery | true | 21.06.16 | 直播扭蛋活动抽奖 |
-| VipPrivilege | true | 21.06.16 | 每月领取年度大会员特权(B币券、会员购优惠券) |
-| BpConsumption | true | 21.06.16 | 每月消费使用年度大会员特权的B币券 |
-| Statistics | true | 21.06.16 | 全局抽奖结果统计 |
+| CheckUpdate | true | 21.06.23 | 程序检查更新 |
+| Login | true | 21.06.23 | 账号登录、刷新、维持 |
+| Schedule | true | 21.06.23 | 控制插件运行周期 |
+| MainSite | true | 21.06.23 | 投币、观看、分享视频 (速升6级不是梦) |
+| DailyBag | true | 21.06.23 | 双端领取日常/周常礼包 |
+| ManGa | true | 21.06.23 | 漫画签到、分享 |
+| ActivityLottery | true | 21.06.23 | 主站活动九宫格抽奖 |
+| Competition | true | 21.06.23 | 游戏赛事竞猜 |
+| DoubleHeart | true | 21.06.23 | 双端心跳 (姥爷直播经验) |
+| DailyTask | true | 21.06.23 | 直播每日任务(签到、观看) |
+| Barrage | true | 21.06.23 | 保持活跃弹幕 |
+| Silver2Coin | true | 21.06.23 | 银瓜子兑换硬币 |
+| Judge | true | 21.06.23 | 风纪委员投票 |
+| GiftSend | true | 21.06.23 | 礼物赠送、维持每日勋章亲密度 |
+| GroupSignIn | true | 21.06.23 | 友爱社签到 |
+| GiftHeart | true | 21.06.23 | 日常心跳每日礼包礼物 |
+| SmallHeart | true | 21.06.23 | 直播挂机,每日24个小心心 |
+| MaterialObject | true | 21.06.23 | 直播金色宝箱实物抽奖 |
+| AloneTcpClient | true | 21.06.23 | 作者的独立直播监控(可支持本项目哦) |
+| ZoneTcpClient | true | 21.06.23 | 官方的分区直播监控 |
+| StormRaffle | true | 21.06.23 | 直播节奏风暴抽奖、亿元 |
+| GiftRaffle | true | 21.06.23 | 直播礼物抽奖 |
+| PkRaffle | true | 21.06.23 | 直播大乱斗抽奖 |
+| GuardRaffle | true | 21.06.23 | 直播大航海抽奖 |
+| AnchorRaffle | true | 21.06.23 | 直播天选时刻抽奖 |
+| GiftRaffle | true | 21.06.23 | 直播礼物抽奖 |
+| AwardRecord | true | 21.06.23 | 最新的中奖纪录通知 |
+| Forward | true | 21.06.23 | 主站动态抽奖转发 |
+| CapsuleLottery | true | 21.06.23 | 直播扭蛋活动抽奖 |
+| PolishTheMedal | true | 21.06.23 | 每日自动点亮灰色勋章 |
+| CapsuleLottery | true | 21.06.23 | 直播扭蛋活动抽奖 |
+| VipPrivilege | true | 21.06.23 | 每月领取年度大会员特权(B币券、会员购优惠券) |
+| BpConsumption | true | 21.06.23 | 每月消费使用年度大会员特权的B币券 |
+| Statistics | true | 21.06.23 | 全局抽奖结果统计 |
| Silver | false | 21.03.27 | 直播银瓜子自动开启宝箱 |
## 交流反馈
diff --git a/data/activity_infos.json b/data/activity_infos.json
index 832be33..9b50c37 100644
--- a/data/activity_infos.json
+++ b/data/activity_infos.json
@@ -31,62 +31,6 @@
"share": "true",
"draw_times": 1,
"expire_at": "2021-07-15 11:59:59"
- },
- {
- "url": "https://www.bilibili.com/blackboard/activity-aT7zphkwF1.html",
- "title": "初夏逛吃大会",
- "description": "活动期间每天分享页面,新增一次机会。",
- "sid": "01aff78a-9e1a-11eb-8597-246e966235d8",
- "login": "true",
- "follow": "false",
- "share": "true",
- "draw_times": 1,
- "expire_at": "2021-06-10 23:59:59"
- },
- {
- "url": "https://www.bilibili.com/blackboard/activity-Tpo81ydpiW.html",
- "title": "和平精英周年庆嘉年华1次",
- "description": "活动期间每天分享页面,新增一次机会。",
- "sid": "e2d93baa-96b9-11eb-8597-246e966235d8",
- "login": "true",
- "follow": "false",
- "share": "true",
- "draw_times": 1,
- "expire_at": "2021-06-15 23:59:59"
- },
- {
- "url": "https://www.bilibili.com/blackboard/activity-Tpo81ydpiW.html",
- "title": "和平精英周年庆嘉年华2次",
- "description": "活动期间每天分享页面,新增一次机会。",
- "sid": "e2d93baa-96b9-11eb-8597-246e966235d8",
- "login": "true",
- "follow": "false",
- "share": "true",
- "draw_times": 1,
- "expire_at": "2021-06-15 23:59:59"
- },
- {
- "url": "https://www.bilibili.com/blackboard/activity-Tpo81ydpiW.html",
- "title": "和平精英周年庆嘉年华3次",
- "description": "活动期间每天分享页面,新增一次机会。",
- "sid": "e2d93baa-96b9-11eb-8597-246e966235d8",
- "login": "true",
- "follow": "false",
- "share": "true",
- "draw_times": 1,
- "expire_at": "2021-06-15 23:59:59"
- }
- ,
- {
- "url": "https://www.bilibili.com/blackboard/topic/activity-natsume.html",
- "title": "夏目友人帐新作动画有奖预约页",
- "description": "活动期间每天分享页面,新增一次机会。",
- "sid": "a213c0b5-b6d4-11eb-8597-246e966235d8",
- "login": "true",
- "follow": "false",
- "share": "true",
- "draw_times": 1,
- "expire_at": "2021-06-15 23:59:59"
}
]
}
\ No newline at end of file
diff --git a/data/capsule_infos.json b/data/capsule_infos.json
index d7e518f..1554e38 100644
--- a/data/capsule_infos.json
+++ b/data/capsule_infos.json
@@ -5,9 +5,9 @@
"data": [
{
"_url": "注释: 活动地址",
- "url": "https://www.bilibili.com/blackboard/activity-raop07Ymhm.html",
+ "url": "https://www.bilibili.com/blackboard/activity-kiOl0D1nF8.html",
"_title": "注释: 活动标题",
- "title": "原神1.5版本UP主激励计划",
+ "title": "原神1.6版本UP主激励计划",
"_description": "注释: 活动描述",
"description": "每日在原神分区任意直播间观看,20分钟1张、1小时2张、2小时3张,每日最高6张。",
"_room_id": "注释: 活动直播间,如果为0,则取分区随机一个",
@@ -17,13 +17,15 @@
"_parent_area_id": "注释: 主分区id",
"parent_area_id": 3,
"_coin_id": "注释: 抽奖id",
- "coin_id": 135,
+ "coin_id": 165,
+ "_pool_id": "注释: 抽奖id",
+ "pool_id": 179,
"_watch_time": "注释: 观看时长 单位秒",
"watch_time": 7320,
"_draw_times": "注释: 抽奖次数",
- "draw_times": 1,
+ "draw_times": 6,
"_expire_at": "注释: 活动有效时间",
- "expire_at": "2021-06-08 23:59:59"
+ "expire_at": "2021-07-20 23:59:59"
},
{
"url": "https://live.bilibili.com/11218604",
@@ -32,10 +34,11 @@
"room_id": 11218604,
"area_id": 0,
"parent_area_id": 2,
- "coin_id": 129,
+ "coin_id": 170,
+ "pool_id": 183,
"watch_time": 3720,
"draw_times": 3,
- "expire_at": "2021-05-30 23:59:59"
+ "expire_at": "2021-06-27 23:59:59"
},
{
"url": "https://live.bilibili.com/6",
diff --git a/data/latest_version.json b/data/latest_version.json
index 6c97590..436c604 100644
--- a/data/latest_version.json
+++ b/data/latest_version.json
@@ -5,7 +5,7 @@
"source": "https://github.com/lkeme/BiliHelper-personal",
"raw_url": "https://cdn.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest_version.json",
"purge_url": "https://purge.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest_version.json",
- "version": "0.9.2.210602",
+ "version": "0.9.4.210623",
"des": "程序有更新,请及时线上查看更新哦~",
- "time": "2021年6月2日21:40:35"
+ "time": "2021年6月23日21:40:35"
}
\ No newline at end of file
diff --git a/src/core/App.php b/src/core/App.php
index 25ccbae..ecdce88 100644
--- a/src/core/App.php
+++ b/src/core/App.php
@@ -42,7 +42,7 @@ class App
* @param string $load_file
* @return $this
*/
- public function load($load_file = 'user.ini'): App
+ public function load(string $load_file = 'user.ini'): App
{
Config::load($load_file);
return $this;
diff --git a/src/plugin/Live.php b/src/plugin/Live.php
index b9914ec..834eb44 100644
--- a/src/plugin/Live.php
+++ b/src/plugin/Live.php
@@ -246,7 +246,7 @@ class Live
{
$room_id = self::getRealRoomID($room_id);
if (!$room_id) {
- return ['code' => 404, 'msg' => '直播间数据异常'];
+ return ['code' => 404, 'message' => '直播间数据异常'];
}
$url = 'https://api.live.bilibili.com/msg/send';
$payload = [
@@ -279,7 +279,7 @@ class Live
{
$room_id = self::getRealRoomID($room_id);
if (!$room_id) {
- return ['code' => 404, 'msg' => '直播间数据异常'];
+ return ['code' => 404, 'message' => '直播间数据异常'];
}
$url = 'https://api.live.bilibili.com/msg/send';
$payload = [
diff --git a/src/plugin/MainSite.php b/src/plugin/MainSite.php
index 4c438d5..dac6dd6 100644
--- a/src/plugin/MainSite.php
+++ b/src/plugin/MainSite.php
@@ -50,13 +50,15 @@ class MainSite
'Referer' => "https://www.bilibili.com/video/av{$aid}",
'User-Agent' => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36",
];
+ // {"code":34005,"message":"超过投币上限啦~","ttl":1,"data":{"like":false}}
+ // {"code":0,"message":"0","ttl":1,"data":{"like":false}}
$raw = Curl::post('app', $url, Sign::common($payload), $headers);
$de_raw = json_decode($raw, true);
if ($de_raw['code'] == 0) {
- Log::notice("主站任务: av{$aid} 投币成功");
+ Log::notice("主站任务: av{$aid} 投币成功 {$de_raw['code']} MSG -> {$de_raw['message']}");
return true;
} else {
- Log::warning("主站任务: av{$aid} 投币失败");
+ Log::warning("主站任务: av{$aid} 投币失败 CODE -> {$de_raw['code']} MSG -> {$de_raw['message']}");
return false;
}
}
@@ -120,7 +122,7 @@ class MainSite
// 稿件列表
if (getConf('add_coin_mode', 'main_site') == 'random') {
// 随机热门稿件榜单
- $aids = self::getDayRankingAids($actual_num);
+ $aids = self::getTopRCmdAids($actual_num);
} else {
// 固定获取关注UP稿件榜单, 不足会随机补全
$aids = self::getFollowUpAids($actual_num);
@@ -181,7 +183,7 @@ class MainSite
}
// 此处补全缺失
if (count($aids) < $num) {
- $aids = array_merge($aids, self::getDayRankingAids($num - count($aids)));
+ $aids = array_merge($aids, self::getTopRCmdAids($num - count($aids)));
}
return $aids;
}
@@ -222,6 +224,34 @@ class MainSite
return $aids;
}
+ /**
+ * @use 首页推荐
+ * @param int $num
+ * @param int $ps
+ * @return array
+ */
+ private static function getTopRCmdAids(int $num, int $ps = 30): array
+ {
+ // 动画1 国创168 音乐3 舞蹈129 游戏4 知识36 科技188 汽车223 生活160 美食211 动物圈127 鬼畜119 时尚155 资讯202 娱乐5 影视181
+ $rids = [1, 168, 3, 129, 4, 36, 188, 223, 160, 211, 127, 119, 155, 202, 5, 181];
+ $aids = [];
+ $url = 'https://api.bilibili.com/x/web-interface/dynamic/region';
+ $payload = [
+ 'ps' => $ps,
+ 'rid' => $rids[array_rand($rids)],
+ ];
+ $raw = Curl::get('other', $url, $payload);
+ $de_raw = json_decode($raw, true);
+ if ($de_raw['code'] == 0) {
+ $temps = array_rand($de_raw['data']['archives'], $num);
+ foreach ($temps as $temp) {
+ array_push($aids, $de_raw['data']['archives'][$temp]['aid']);
+ }
+ return $aids;
+ }
+ return self::getDayRankingAids($num);
+ }
+
/**
* @use 分享视频
* @return bool
diff --git a/src/plugin/Silver2Coin.php b/src/plugin/Silver2Coin.php
index f7a81f8..ed0ed4f 100644
--- a/src/plugin/Silver2Coin.php
+++ b/src/plugin/Silver2Coin.php
@@ -43,7 +43,7 @@ class Silver2Coin
$raw = Curl::get('app', $url, Sign::common($payload));
$de_raw = json_decode($raw, true);
- return self::handle('APP', $de_raw);
+ return self::appHandle('APP', $de_raw);
}
@@ -54,13 +54,18 @@ class Silver2Coin
protected static function pcSilver2coin(): bool
{
sleep(0.5);
- $payload = [];
+ $payload = [
+ 'csrf_token' => getCsrf(),
+ 'csrf' => getCsrf(),
+ 'visit_id' => ''
+ ];
$url = "https://api.live.bilibili.com/exchange/silver2coin";
$url = "https://api.live.bilibili.com/pay/v1/Exchange/silver2coin";
- $raw = Curl::get('pc', $url, $payload);
+ $url = "https://api.live.bilibili.com/xlive/revenue/v1/wallet/silver2coin";
+ $raw = Curl::post('pc', $url, $payload);
$de_raw = json_decode($raw, true);
- return self::handle('PC', $de_raw);
+ return self::pcHandle('PC', $de_raw);
}
/**
@@ -69,7 +74,7 @@ class Silver2Coin
* @param array $data
* @return bool
*/
- private static function handle(string $type, array $data): bool
+ private static function appHandle(string $type, array $data): bool
{
// {"code":403,"msg":"每天最多能兑换 1 个","message":"每天最多能兑换 1 个","data":[]}
// {"code":403,"msg":"仅主站正式会员以上的用户可以兑换","message":"仅主站正式会员以上的用户可以兑换","data":[]}
@@ -86,4 +91,28 @@ class Silver2Coin
return false;
}
}
+
+ /**
+ * @use 处理结果
+ * @param string $type
+ * @param array $data
+ * @return bool
+ */
+ private static function pcHandle(string $type, array $data): bool
+ {
+ // {"code":403,"msg":"每天最多能兑换 1 个","message":"每天最多能兑换 1 个","data":[]}
+ // {"code":403,"msg":"仅主站正式会员以上的用户可以兑换","message":"仅主站正式会员以上的用户可以兑换","data":[]}
+ // {"code":0,"msg":"兑换成功","message":"兑换成功","data":{"gold":"5074","silver":"36734","tid":"727ab65376a15a6b117cf560a20a21122334","coin":1}}
+ switch ($data['code']) {
+ case 0:
+ Log::notice("[{$type}] 银瓜子兑换硬币: {$data['message']}");
+ return true;
+ case 403:
+ Log::warning("[{$type}] 银瓜子兑换硬币: {$data['message']}");
+ return true;
+ default:
+ Log::warning("[{$type}] 银瓜子兑换硬币: CODE -> {$data['code']} MSG -> {$data['message']} ");
+ return false;
+ }
+ }
}
\ No newline at end of file
From 09d26441e78a073b4796dd6a5c3fad667445e1c7 Mon Sep 17 00:00:00 2001
From: Lkeme <19500576+lkeme@users.noreply.github.com>
Date: Wed, 23 Jun 2021 16:52:37 +0800
Subject: [PATCH 19/28] [fix] Silver2Coin
---
src/plugin/Silver2Coin.php | 37 +++++++------------------------------
1 file changed, 7 insertions(+), 30 deletions(-)
diff --git a/src/plugin/Silver2Coin.php b/src/plugin/Silver2Coin.php
index ed0ed4f..89d587f 100644
--- a/src/plugin/Silver2Coin.php
+++ b/src/plugin/Silver2Coin.php
@@ -40,10 +40,10 @@ class Silver2Coin
sleep(0.5);
$url = 'https://api.live.bilibili.com/AppExchange/silver2coin';
$payload = [];
- $raw = Curl::get('app', $url, Sign::common($payload));
+ $raw = Curl::post('app', $url, Sign::common($payload));
$de_raw = json_decode($raw, true);
- return self::appHandle('APP', $de_raw);
+ return self::handle('APP', $de_raw);
}
@@ -59,13 +59,13 @@ class Silver2Coin
'csrf' => getCsrf(),
'visit_id' => ''
];
- $url = "https://api.live.bilibili.com/exchange/silver2coin";
- $url = "https://api.live.bilibili.com/pay/v1/Exchange/silver2coin";
+ // $url = "https://api.live.bilibili.com/exchange/silver2coin";
+ // $url = "https://api.live.bilibili.com/pay/v1/Exchange/silver2coin";
$url = "https://api.live.bilibili.com/xlive/revenue/v1/wallet/silver2coin";
$raw = Curl::post('pc', $url, $payload);
$de_raw = json_decode($raw, true);
- return self::pcHandle('PC', $de_raw);
+ return self::handle('PC', $de_raw);
}
/**
@@ -74,35 +74,12 @@ class Silver2Coin
* @param array $data
* @return bool
*/
- private static function appHandle(string $type, array $data): bool
- {
- // {"code":403,"msg":"每天最多能兑换 1 个","message":"每天最多能兑换 1 个","data":[]}
- // {"code":403,"msg":"仅主站正式会员以上的用户可以兑换","message":"仅主站正式会员以上的用户可以兑换","data":[]}
- // {"code":0,"msg":"兑换成功","message":"兑换成功","data":{"gold":"5074","silver":"36734","tid":"727ab65376a15a6b117cf560a20a21122334","coin":1}}
- switch ($data['code']) {
- case 0:
- Log::notice("[{$type}] 银瓜子兑换硬币: {$data['msg']}");
- return true;
- case 403:
- Log::warning("[{$type}] 银瓜子兑换硬币: {$data['msg']}");
- return true;
- default:
- Log::warning("[{$type}] 银瓜子兑换硬币: CODE -> {$data['code']} MSG -> {$data['msg']} ");
- return false;
- }
- }
-
- /**
- * @use 处理结果
- * @param string $type
- * @param array $data
- * @return bool
- */
- private static function pcHandle(string $type, array $data): bool
+ private static function handle(string $type, array $data): bool
{
// {"code":403,"msg":"每天最多能兑换 1 个","message":"每天最多能兑换 1 个","data":[]}
// {"code":403,"msg":"仅主站正式会员以上的用户可以兑换","message":"仅主站正式会员以上的用户可以兑换","data":[]}
// {"code":0,"msg":"兑换成功","message":"兑换成功","data":{"gold":"5074","silver":"36734","tid":"727ab65376a15a6b117cf560a20a21122334","coin":1}}
+ // {"code":0,"data":{"coin":1,"gold":1234,"silver":4321,"tid":"Silver2Coin21062316490299678123456"},"message":"兑换成功"}
switch ($data['code']) {
case 0:
Log::notice("[{$type}] 银瓜子兑换硬币: {$data['message']}");
From a45185da617c28d2236c7dbb92214f9889449a91 Mon Sep 17 00:00:00 2001
From: Lkeme <19500576+lkeme@users.noreply.github.com>
Date: Wed, 23 Jun 2021 17:05:12 +0800
Subject: [PATCH 20/28] [update] BaseParams
---
CHANGELOG.md | 1 +
src/core/Curl.php | 2 +-
src/plugin/Sign.php | 4 ++--
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 44e2b9f..b90bc19 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@
### Changed
- 更新部分仓库文件
+- 更新基础环境参数
-
### Fixed
diff --git a/src/core/Curl.php b/src/core/Curl.php
index f1ac25a..6052dd0 100644
--- a/src/core/Curl.php
+++ b/src/core/Curl.php
@@ -243,7 +243,7 @@ class Curl
'Connection' => 'keep-alive',
// 'Content-Type' => 'application/x-www-form-urlencoded',
// 'User-Agent' => 'Mozilla/5.0 BiliDroid/5.51.1 (bbcallen@gmail.com)',
- 'User-Agent' => 'Mozilla/5.0 BiliDroid/6.28.0 (bbcallen@gmail.com) os/android model/MuMu mobi_app/android build/6280300 channel/bili innerVer/6280300 osVer/6.0.1 network/2',
+ 'User-Agent' => 'Mozilla/5.0 BiliDroid/6.29.0 (bbcallen@gmail.com) os/android model/MuMu mobi_app/android build/6290300 channel/bili innerVer/6290300 osVer/7.1.2 network/2',
// 'Referer' => 'https://live.bilibili.com/',
];
$pc_headers = [
diff --git a/src/plugin/Sign.php b/src/plugin/Sign.php
index cc245ea..4562eed 100644
--- a/src/plugin/Sign.php
+++ b/src/plugin/Sign.php
@@ -55,7 +55,7 @@ class Sign
'access_key' => getConf('access_token', 'login.auth'),
'actionKey' => 'appkey',
'appkey' => $appkey,
- 'build' => 6280300,
+ 'build' => 6290300,
'channel' => 'bili',
'device' => 'phone',
'mobi_app' => 'android',
@@ -84,7 +84,7 @@ class Sign
'access_key' => getConf('access_token', 'login.auth'),
'actionKey' => 'appkey',
'appkey' => $appkey,
- 'build' => 6280300,
+ 'build' => 6290300,
'device' => 'phone',
'mobi_app' => 'android',
'platform' => 'android',
From d74865affbc32905f54603af32a190ffddd556ee Mon Sep 17 00:00:00 2001
From: Lkeme <19500576+lkeme@users.noreply.github.com>
Date: Thu, 24 Jun 2021 10:47:51 +0800
Subject: [PATCH 21/28] [update] DynamicForward
---
CHANGELOG.md | 21 ++
README.md | 70 ++--
conf/user.ini.example | 6 +-
data/filter_library.json | 753 +++++++++++++++++++++++++++++++++++++++
data/filter_words.json | 324 -----------------
data/latest_version.json | 4 +-
data/reply_words.json | 175 +++++++++
src/core/Curl.php | 2 +-
src/plugin/Dynamic.php | 48 ++-
src/plugin/Forward.php | 64 ++--
src/plugin/Live.php | 35 ++
src/plugin/Sign.php | 4 +-
src/util/FilterWords.php | 2 +-
13 files changed, 1113 insertions(+), 395 deletions(-)
create mode 100644 data/filter_library.json
delete mode 100644 data/filter_words.json
create mode 100644 data/reply_words.json
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b90bc19..6c1ecd2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,27 @@
# 本项目Log
+## v0.9.5.210624 alpha (2021-06-24)
+
+### Added
+
+-
+
+### Changed
+
+- 更新动态转发
+- 更新基础环境参数
+-
+
+### Fixed
+
+-
+
+### Remarks
+
+- 注意配置文件有些许改动
+-
+
## v0.9.4.210623 alpha (2021-06-23)
### Added
diff --git a/README.md b/README.md
index 43d2053..3221ea6 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@
-
+
@@ -37,40 +37,40 @@
| plugin | status | version | description |
|-----------------|--------|----------|---------------------------------------------|
-| CheckUpdate | true | 21.06.23 | 程序检查更新 |
-| Login | true | 21.06.23 | 账号登录、刷新、维持 |
-| Schedule | true | 21.06.23 | 控制插件运行周期 |
-| MainSite | true | 21.06.23 | 投币、观看、分享视频 (速升6级不是梦) |
-| DailyBag | true | 21.06.23 | 双端领取日常/周常礼包 |
-| ManGa | true | 21.06.23 | 漫画签到、分享 |
-| ActivityLottery | true | 21.06.23 | 主站活动九宫格抽奖 |
-| Competition | true | 21.06.23 | 游戏赛事竞猜 |
-| DoubleHeart | true | 21.06.23 | 双端心跳 (姥爷直播经验) |
-| DailyTask | true | 21.06.23 | 直播每日任务(签到、观看) |
-| Barrage | true | 21.06.23 | 保持活跃弹幕 |
-| Silver2Coin | true | 21.06.23 | 银瓜子兑换硬币 |
-| Judge | true | 21.06.23 | 风纪委员投票 |
-| GiftSend | true | 21.06.23 | 礼物赠送、维持每日勋章亲密度 |
-| GroupSignIn | true | 21.06.23 | 友爱社签到 |
-| GiftHeart | true | 21.06.23 | 日常心跳每日礼包礼物 |
-| SmallHeart | true | 21.06.23 | 直播挂机,每日24个小心心 |
-| MaterialObject | true | 21.06.23 | 直播金色宝箱实物抽奖 |
-| AloneTcpClient | true | 21.06.23 | 作者的独立直播监控(可支持本项目哦) |
-| ZoneTcpClient | true | 21.06.23 | 官方的分区直播监控 |
-| StormRaffle | true | 21.06.23 | 直播节奏风暴抽奖、亿元 |
-| GiftRaffle | true | 21.06.23 | 直播礼物抽奖 |
-| PkRaffle | true | 21.06.23 | 直播大乱斗抽奖 |
-| GuardRaffle | true | 21.06.23 | 直播大航海抽奖 |
-| AnchorRaffle | true | 21.06.23 | 直播天选时刻抽奖 |
-| GiftRaffle | true | 21.06.23 | 直播礼物抽奖 |
-| AwardRecord | true | 21.06.23 | 最新的中奖纪录通知 |
-| Forward | true | 21.06.23 | 主站动态抽奖转发 |
-| CapsuleLottery | true | 21.06.23 | 直播扭蛋活动抽奖 |
-| PolishTheMedal | true | 21.06.23 | 每日自动点亮灰色勋章 |
-| CapsuleLottery | true | 21.06.23 | 直播扭蛋活动抽奖 |
-| VipPrivilege | true | 21.06.23 | 每月领取年度大会员特权(B币券、会员购优惠券) |
-| BpConsumption | true | 21.06.23 | 每月消费使用年度大会员特权的B币券 |
-| Statistics | true | 21.06.23 | 全局抽奖结果统计 |
+| CheckUpdate | true | 21.06.24 | 程序检查更新 |
+| Login | true | 21.06.24 | 账号登录、刷新、维持 |
+| Schedule | true | 21.06.24 | 控制插件运行周期 |
+| MainSite | true | 21.06.24 | 投币、观看、分享视频 (速升6级不是梦) |
+| DailyBag | true | 21.06.24 | 双端领取日常/周常礼包 |
+| ManGa | true | 21.06.24 | 漫画签到、分享 |
+| ActivityLottery | true | 21.06.24 | 主站活动九宫格抽奖 |
+| Competition | true | 21.06.24 | 游戏赛事竞猜 |
+| DoubleHeart | true | 21.06.24 | 双端心跳 (姥爷直播经验) |
+| DailyTask | true | 21.06.24 | 直播每日任务(签到、观看) |
+| Barrage | true | 21.06.24 | 保持活跃弹幕 |
+| Silver2Coin | true | 21.06.24 | 银瓜子兑换硬币 |
+| Judge | true | 21.06.24 | 风纪委员投票 |
+| GiftSend | true | 21.06.24 | 礼物赠送、维持每日勋章亲密度 |
+| GroupSignIn | true | 21.06.24 | 友爱社签到 |
+| GiftHeart | true | 21.06.24 | 日常心跳每日礼包礼物 |
+| SmallHeart | true | 21.06.24 | 直播挂机,每日24个小心心 |
+| MaterialObject | true | 21.06.24 | 直播金色宝箱实物抽奖 |
+| AloneTcpClient | true | 21.06.24 | 作者的独立直播监控(可支持本项目哦) |
+| ZoneTcpClient | true | 21.06.24 | 官方的分区直播监控 |
+| StormRaffle | true | 21.06.24 | 直播节奏风暴抽奖、亿元 |
+| GiftRaffle | true | 21.06.24 | 直播礼物抽奖 |
+| PkRaffle | true | 21.06.24 | 直播大乱斗抽奖 |
+| GuardRaffle | true | 21.06.24 | 直播大航海抽奖 |
+| AnchorRaffle | true | 21.06.24 | 直播天选时刻抽奖 |
+| GiftRaffle | true | 21.06.24 | 直播礼物抽奖 |
+| AwardRecord | true | 21.06.24 | 最新的中奖纪录通知 |
+| Forward | true | 21.06.24 | 主站动态抽奖转发 |
+| CapsuleLottery | true | 21.06.24 | 直播扭蛋活动抽奖 |
+| PolishTheMedal | true | 21.06.24 | 每日自动点亮灰色勋章 |
+| CapsuleLottery | true | 21.06.24 | 直播扭蛋活动抽奖 |
+| VipPrivilege | true | 21.06.24 | 每月领取年度大会员特权(B币券、会员购优惠券) |
+| BpConsumption | true | 21.06.24 | 每月消费使用年度大会员特权的B币券 |
+| Statistics | true | 21.06.24 | 全局抽奖结果统计 |
| Silver | false | 21.03.27 | 直播银瓜子自动开启宝箱 |
## 交流反馈
diff --git a/conf/user.ini.example b/conf/user.ini.example
index da45bf1..2e355d1 100644
--- a/conf/user.ini.example
+++ b/conf/user.ini.example
@@ -136,12 +136,14 @@ bp2charge_uid = 6580464
# 消费B币充值金瓜子|5000金瓜子
bp2gold = false
-; 自动转发抽奖动态|自动取关未中奖动态|强制清除抽奖组关注|更改自动回复语言
+; 自动转发抽奖动态|自动取关未中奖动态|强制清除抽奖组关注|过滤低于多少粉丝|自定义回复|过滤词|逗号分割
[dynamic]
enable = false
clear_dynamic = false
clear_group_follow = false
-auto_reply_text = "从未中奖,从未放弃[doge]"
+min_fans_num = 1001
+auto_reply_text =
+filter_words =
; 游戏赛事竞猜预测|破产机|每日竞猜次数|每次竞猜硬币(1-10)|下注(1.压大,2.压小,3.随机)
[match_forecast]
diff --git a/data/filter_library.json b/data/filter_library.json
new file mode 100644
index 0000000..b74ef81
--- /dev/null
+++ b/data/filter_library.json
@@ -0,0 +1,753 @@
+{
+ "MaterialObject": {
+ "sensitive": [
+ "测试",
+ "加密",
+ "test",
+ "TEST",
+ "钓鱼",
+ "炸鱼",
+ "调试",
+ "123",
+ "1111",
+ "测试",
+ "測試",
+ "Test",
+ "测一测",
+ "ce-shi",
+ "test",
+ "T-E-S-T",
+ "lala",
+ "我是抽奖标题",
+ "压测",
+ "測一測",
+ "t-e-s-t"
+ ]
+ },
+ "Anchor": {
+ "default": [
+ "拉黑",
+ "黑名单",
+ "脸皮厚",
+ "没有奖品",
+ "无奖",
+ "脸皮厚",
+ "ceshi",
+ "测试",
+ "测试",
+ "测试",
+ "脚本",
+ "抽奖号",
+ "星段位",
+ "星段位",
+ "圣晶石",
+ "圣晶石",
+ "水晶",
+ "水晶",
+ "万兴神剪手",
+ "万兴神剪手",
+ "自付邮费",
+ "自付邮费",
+ "test",
+ "Test",
+ "TEST",
+ "加密",
+ "QQ",
+ "测试",
+ "測試",
+ "VX",
+ "vx",
+ "ce",
+ "shi",
+ "这是一个",
+ "lalall",
+ "第一波",
+ "第二波",
+ "第三波",
+ "测试用",
+ "抽奖标题",
+ "策是",
+ "房间抽奖",
+ "CESHI",
+ "ceshi",
+ "奖品A",
+ "奖品B",
+ "奖品C",
+ "硬币",
+ "无奖品",
+ "白名单",
+ "我是抽奖",
+ "0.1",
+ "五毛二",
+ "一分",
+ "一毛",
+ "0.52",
+ "0.66",
+ "0.01",
+ "0.77",
+ "0.16",
+ "照片",
+ "穷",
+ "0.5",
+ "0.88",
+ "双排",
+ "1毛",
+ "1分",
+ "1角",
+ "P口罩",
+ "素颜",
+ "写真",
+ "图包",
+ "五毛",
+ "一角",
+ "冥币",
+ "自拍",
+ "日历",
+ "0.22",
+ "加速器",
+ "越南盾",
+ "毛",
+ "分",
+ "限",
+ "0.",
+ "角",
+ "〇点",
+ "①元",
+ "一起玩",
+ "不包邮",
+ "邮费",
+ "续期卡",
+ "儿时",
+ "闪宠",
+ "大师球",
+ "一元",
+ "两元",
+ "两块",
+ "赛车",
+ "代币",
+ "一块",
+ "一局",
+ "好友位",
+ "通话",
+ "首胜",
+ "代金券",
+ "辣条",
+ "补贴",
+ "抵用券",
+ "主播素颜照",
+ "武器箱棺材板",
+ "游戏道具",
+ "优惠券",
+ "日元",
+ "发音课",
+ "壹元",
+ "零点",
+ "舰长五折券",
+ "上车",
+ "没有钱",
+ "女装",
+ "肥宅快乐水",
+ "哥斯拉",
+ "公主连结",
+ "pokemmo",
+ "宝可>梦",
+ "明日方舟",
+ "雪碧",
+ "公主连接",
+ "专属头衔",
+ "FF14",
+ "韩元",
+ "空洞骑士",
+ "老婆饼",
+ "稀世时装",
+ "洛克衣服",
+ "帮过图",
+ "证件照",
+ "自抽号",
+ "晶耀之星",
+ "伊洛纳",
+ "〇.",
+ "②元",
+ "③元",
+ "0·",
+ "繁华美化",
+ "喵喵喵",
+ "闪伊布",
+ "①圆",
+ "o点",
+ "金达摩",
+ "嗷呜",
+ "游戏位",
+ "S-追光者",
+ "OWL",
+ "勾玉",
+ "跟yo宝游戏",
+ "三元",
+ "怡宝",
+ "蛋闪迷>你冰",
+ "哥伦比亚比索",
+ "油条",
+ "代金卷",
+ "小堂包",
+ "返现券",
+ "上舰",
+ "舰长",
+ "开舰",
+ "帅照",
+ "靓照",
+ "1元红包",
+ "红包3.3元",
+ "5.2元红包",
+ "2.33元红包",
+ "测试",
+ "钓鱼",
+ "炸鱼",
+ "黑屋",
+ "脚本",
+ "空气",
+ "大航海",
+ "上船",
+ "舰长",
+ "返现",
+ "抵用",
+ "代金",
+ "上车",
+ "上反船",
+ "照片",
+ "素颜",
+ "自拍",
+ "皂片",
+ "开舰",
+ "上舰",
+ "自画像",
+ "封面",
+ "取关",
+ "美照",
+ "随机照",
+ "女装照",
+ "日常照",
+ "好友",
+ "给主播",
+ "照骗",
+ "连麦",
+ "情书",
+ "一局",
+ "舰涨优惠卷",
+ "开黑",
+ "test",
+ "Test",
+ "金币",
+ "元宝",
+ "代打",
+ "上分",
+ "上段",
+ "台历",
+ "一毛",
+ "五毛",
+ "王者荣耀",
+ "玩游戏",
+ "encrypt",
+ "壁纸",
+ "相片",
+ "排位",
+ "语音",
+ "车位",
+ "网剧",
+ "一起玩",
+ "一次",
+ "专属头衔",
+ "手游",
+ "宠物",
+ "蒸汽",
+ "月饼",
+ "加速",
+ "挂件",
+ "渔夫",
+ "小黑屋",
+ "头像",
+ "许愿码",
+ "电池",
+ "赛车",
+ "保底",
+ "代币",
+ "越南盾",
+ "网点",
+ "机器",
+ "话梅",
+ "志愿",
+ "令牌",
+ "永久",
+ "第五人格",
+ "大蒜",
+ "唢呐",
+ "皇冠",
+ "徽章",
+ "铜牌",
+ "动物园",
+ "植物",
+ "钻石",
+ "宝石",
+ "尖叫",
+ "扭蛋机",
+ "点播",
+ "数字版月历",
+ "点歌一首",
+ "体验",
+ "点歌",
+ "三次取关",
+ "大航海",
+ "3块钱之前的巨款",
+ "礼金"
+ ]
+ },
+ "CapsuleLottery": {
+ "default": [
+ "谢谢参与",
+ "未中奖",
+ "辣条"
+ ]
+ },
+ "ActivityLottery": {
+ "default": [
+ "谢谢参与",
+ "未中奖",
+ "辣条"
+ ]
+ },
+ "Notice": {
+ "default": [
+ "谢谢参与",
+ "未中奖",
+ "辣条"
+ ]
+ },
+ "DynamicForward": {
+ "default": [
+ "一毛",
+ "结果",
+ "test",
+ "元宝",
+ "晒出",
+ "原石",
+ "代打",
+ "上分",
+ "测试",
+ "闹着玩",
+ "猫粮",
+ "钓鱼",
+ "加密",
+ "好友",
+ "视频下转发",
+ "签名照",
+ "全部答对",
+ "弹幕",
+ "评论下方投稿视频",
+ "征集",
+ "炸鱼",
+ "黑屋",
+ "照片",
+ "素颜",
+ "自拍",
+ "皂片",
+ "自画像",
+ "封面",
+ "取关",
+ "随机照",
+ "宝石",
+ "真情实感",
+ "给主播",
+ "照骗",
+ "连麦",
+ "加群",
+ "钓鱼",
+ "脚本",
+ "代金券",
+ "体验卡",
+ "门票",
+ "渲染券",
+ "机器",
+ "给视频",
+ "投票",
+ "取关",
+ "视频转发",
+ "视频分享",
+ "于视频内",
+ "视频评论",
+ "分享视频",
+ "转发视频",
+ "评论视频",
+ "进入直播间",
+ "平时售价",
+ "体验名额",
+ "评论区点赞前",
+ "上直播",
+ "参与直播抽奖",
+ "堆jqr",
+ "AI转",
+ "AI来",
+ "bot来",
+ "堆bot",
+ "jqr来",
+ "有jqr",
+ "有bot",
+ "jqr",
+ "bot"
+ ]
+ },
+ "Common": {
+ "default": [
+ "禁言",
+ "测试",
+ "vcf",
+ "体验中奖",
+ "中奖的感觉",
+ "赶脚",
+ "感脚",
+ "感jio",
+ "黑名单",
+ "拉黑",
+ "脸皮厚",
+ "没有奖品",
+ "无奖",
+ "ceshi",
+ "脚本",
+ "抽奖号",
+ "不要脸",
+ "至尊vip会员7天",
+ "高级会员7天",
+ "万兴神剪手",
+ "加密",
+ "test",
+ "TEST",
+ "钓鱼",
+ "炸鱼",
+ "调试"
+ ],
+ "sensitive": [
+ "编曲",
+ "作词",
+ "半价",
+ "打折",
+ "机器",
+ "禁言",
+ "测试",
+ "vcf",
+ "体验中奖",
+ "中奖的感觉",
+ "录歌",
+ "混音",
+ "一毛",
+ "0.1元",
+ "1角",
+ "0.5元",
+ "5毛",
+ "赶脚",
+ "感脚",
+ "曲风",
+ "专辑封面",
+ "封面",
+ "一元红包",
+ "感jio",
+ "名片赞",
+ "黑名单",
+ "拉黑",
+ "脸皮厚",
+ "没有奖品",
+ "无奖",
+ "脚本",
+ "抽奖号",
+ "不要脸",
+ "至尊vip会员7天",
+ "高级会员7天",
+ "加密",
+ "test",
+ "TEST",
+ "钓鱼",
+ "炸鱼",
+ "调试",
+ "歌曲定制",
+ "学习视频",
+ "修图视频",
+ "免费编曲",
+ "后期制作",
+ "编曲搬家",
+ "内容自定",
+ "音乐人一个",
+ "私人唱歌",
+ "感恩",
+ "作业",
+ "八字",
+ "算命",
+ "电台",
+ "情感视频",
+ "万兴神剪手",
+ "学习修图",
+ "写一首歌",
+ "ceshi",
+ "管饱",
+ "dong tai ga",
+ "电话唱歌",
+ "感谢转发",
+ "非独家使用权",
+ "前排沙发",
+ "琴谱",
+ "有就送",
+ "什么也不给",
+ "什么都没有",
+ "租赁",
+ "伴奏",
+ "定制beat",
+ "定制logo",
+ "惊喜软件",
+ "终于中奖",
+ "加群",
+ "第一批粉丝",
+ "祝大家",
+ "内部群",
+ "老粉",
+ "仅关注",
+ "仅我关注",
+ "打字粉丝ID",
+ "手打粉丝ID",
+ "人声采集",
+ "采样包",
+ "约稿",
+ "remix",
+ "明信片",
+ "感受中奖",
+ "快落",
+ "中奖的快乐",
+ "单曲",
+ "主题创作",
+ "猎妈",
+ "签名照",
+ "数字专辑",
+ "除夕夜",
+ "专辑",
+ "励志的话",
+ "亲笔签名",
+ "up",
+ "扫码进群",
+ "粉丝群",
+ "签名写真",
+ "纹身",
+ "祝你",
+ "红包雨",
+ "电子书",
+ "我",
+ "好友位",
+ "豪车优惠",
+ "观众老爷",
+ "的支持",
+ "星段位",
+ "圣晶石",
+ "水晶",
+ "QQ",
+ "自付邮费",
+ "Test",
+ "测试用",
+ "VX",
+ "vx",
+ "ce",
+ "shi",
+ "这是一个",
+ "lalall",
+ "第一波",
+ "第二波",
+ "策是",
+ "我是抽奖",
+ "照片",
+ "穷",
+ "0.5",
+ "一角",
+ "冥币",
+ "加速器",
+ "硬币",
+ "无奖品",
+ "白名单",
+ "奖品B",
+ "奖品C",
+ "五毛",
+ "第三波",
+ "0.1",
+ "五毛二",
+ "一分",
+ "0.52",
+ "0.66",
+ "0.01",
+ "0.77",
+ "0.16",
+ "0.88",
+ "双排",
+ "1毛",
+ "1分",
+ "P口罩",
+ "素颜",
+ "写真",
+ "图包",
+ "自拍",
+ "日历",
+ "0.22",
+ "房间抽奖",
+ "CESHI",
+ "奖品A",
+ "抽奖标题",
+ "測試",
+ "越南盾",
+ "啥都没有",
+ "哈哈哈",
+ "作曲",
+ "一首",
+ "手绘",
+ "学霸",
+ "buff",
+ "头像",
+ "剩的",
+ "中奖的",
+ "Ziyoda",
+ "Hilola",
+ "beden",
+ "新专",
+ "采样",
+ "音频",
+ "海报",
+ "关注",
+ "粉丝ID",
+ "优惠券",
+ "微博",
+ "互粉",
+ "真心话",
+ "回答",
+ "签名海报",
+ "不想要",
+ "抱抱",
+ "拥抱",
+ "WAV",
+ "邀请函",
+ "你猜猜",
+ "什么也没有",
+ "什么都",
+ "什么也",
+ "这不是抽奖",
+ "真欧",
+ "很欧",
+ "使用权",
+ "曲谱",
+ "啥也没有",
+ "木有",
+ "车载音乐",
+ "中奖滴",
+ "会员歌曲",
+ "一首歌",
+ "必唱",
+ "发文件",
+ "词作",
+ "购买资格",
+ "粉群",
+ "优惠",
+ "折扣",
+ "hoholive",
+ "surat",
+ "hisyat",
+ "免费观",
+ "免费演",
+ "免费门",
+ "谢谢参与",
+ "vx call u",
+ "新婚快乐",
+ "歌曲使用权",
+ "普通mp3使用权",
+ "破解版",
+ "土嗨",
+ "给你写",
+ "普通mp3",
+ "啥也不是",
+ "歌曲大礼包",
+ "歌手大礼包",
+ "无损wav",
+ "mp3使用权",
+ "wav使用权",
+ "曲谱"
+ ],
+ "uid_list": [
+ 28008897,
+ 28272016,
+ 140389827,
+ 24598781,
+ 28008860,
+ 28008880,
+ 28008743,
+ 28008948,
+ 28009292,
+ 319696958,
+ 90138218,
+ 28272000,
+ 28272047,
+ 28271978,
+ 8831288,
+ 175979009,
+ 3177443,
+ 486780865,
+ 403048135,
+ 474325039,
+ 455274996,
+ 477519424,
+ 292671666,
+ 448873224,
+ 22498938,
+ 1770865,
+ 444796995,
+ 306112375,
+ 320193786,
+ 606637517,
+ 305276429,
+ 204487541,
+ 404761800,
+ 186914127,
+ 99439379,
+ 457697569,
+ 270886929,
+ 477519424,
+ 401575,
+ 201296348,
+ 206804212,
+ 333584926,
+ 34679178,
+ 699923691,
+ 392689522,
+ 178700744,
+ 272882445,
+ 350977368,
+ 487168411,
+ 22682842,
+ 444949061,
+ 523974463,
+ 192231907,
+ 503908324,
+ 383189098,
+ 252909207,
+ 336467750,
+ 264875137,
+ 90721742,
+ 452299642,
+ 677739290,
+ 441522918,
+ 8766623,
+ 698327474,
+ 5439672,
+ 483247863,
+ 237055308,
+ 95404163,
+ 202052696,
+ 1309889741,
+ 627942060,
+ 455030741,
+ 406353670,
+ 18036870,
+ 470220612,
+ 432013403,
+ 1346052604,
+ 501312931
+ ]
+ }
+}
\ No newline at end of file
diff --git a/data/filter_words.json b/data/filter_words.json
deleted file mode 100644
index b5eb8ec..0000000
--- a/data/filter_words.json
+++ /dev/null
@@ -1,324 +0,0 @@
-{
- "MaterialObject": {
- "sensitive": [
- "测试",
- "加密",
- "test",
- "TEST",
- "钓鱼",
- "炸鱼",
- "调试",
- "123",
- "1111",
- "测试",
- "測試",
- "Test",
- "测一测",
- "ce-shi",
- "test",
- "T-E-S-T",
- "lala",
- "我是抽奖标题",
- "压测",
- "測一測",
- "t-e-s-t"
- ]
- },
- "Anchor": {
- "default": [
- "拉黑",
- "黑名单",
- "脸皮厚",
- "没有奖品",
- "无奖",
- "脸皮厚",
- "ceshi",
- "测试",
- "测试",
- "测试",
- "脚本",
- "抽奖号",
- "星段位",
- "星段位",
- "圣晶石",
- "圣晶石",
- "水晶",
- "水晶",
- "万兴神剪手",
- "万兴神剪手",
- "自付邮费",
- "自付邮费",
- "test",
- "Test",
- "TEST",
- "加密",
- "QQ",
- "测试",
- "測試",
- "VX",
- "vx",
- "ce",
- "shi",
- "这是一个",
- "lalall",
- "第一波",
- "第二波",
- "第三波",
- "测试用",
- "抽奖标题",
- "策是",
- "房间抽奖",
- "CESHI",
- "ceshi",
- "奖品A",
- "奖品B",
- "奖品C",
- "硬币",
- "无奖品",
- "白名单",
- "我是抽奖",
- "0.1",
- "五毛二",
- "一分",
- "一毛",
- "0.52",
- "0.66",
- "0.01",
- "0.77",
- "0.16",
- "照片",
- "穷",
- "0.5",
- "0.88",
- "双排",
- "1毛",
- "1分",
- "1角",
- "P口罩",
- "素颜",
- "写真",
- "图包",
- "五毛",
- "一角",
- "冥币",
- "自拍",
- "日历",
- "0.22",
- "加速器",
- "越南盾",
- "毛",
- "分",
- "限",
- "0.",
- "角",
- "〇点",
- "①元",
- "一起玩",
- "不包邮",
- "邮费",
- "续期卡",
- "儿时",
- "闪宠",
- "大师球",
- "一元",
- "两元",
- "两块",
- "赛车",
- "代币",
- "一块",
- "一局",
- "好友位",
- "通话",
- "首胜",
- "代金券",
- "辣条",
- "补贴",
- "抵用券",
- "主播素颜照",
- "武器箱棺材板",
- "游戏道具",
- "优惠券",
- "日元",
- "发音课",
- "壹元",
- "零点",
- "舰长五折券",
- "上车",
- "没有钱",
- "女装",
- "肥宅快乐水",
- "哥斯拉",
- "公主连结",
- "pokemmo",
- "宝可>梦",
- "明日方舟",
- "雪碧",
- "公主连接",
- "专属头衔",
- "FF14",
- "韩元",
- "空洞骑士",
- "老婆饼",
- "稀世时装",
- "洛克衣服",
- "帮过图",
- "证件照",
- "自抽号",
- "晶耀之星",
- "伊洛纳",
- "〇.",
- "②元",
- "③元",
- "0·",
- "繁华美化",
- "喵喵喵",
- "闪伊布",
- "①圆",
- "o点",
- "金达摩",
- "嗷呜",
- "游戏位",
- "S-追光者",
- "OWL",
- "勾玉",
- "跟yo宝游戏",
- "三元",
- "怡宝",
- "蛋闪迷>你冰",
- "哥伦比亚比索",
- "油条",
- "代金卷",
- "小堂包",
- "返现券",
- "上舰",
- "舰长",
- "开舰",
- "帅照",
- "靓照",
- "1元红包",
- "红包3.3元",
- "5.2元红包",
- "2.33元红包",
- "测试",
- "钓鱼",
- "炸鱼",
- "黑屋",
- "脚本",
- "空气",
- "大航海",
- "上船",
- "舰长",
- "返现",
- "抵用",
- "代金",
- "上车",
- "上反船",
- "照片",
- "素颜",
- "自拍",
- "皂片",
- "开舰",
- "上舰",
- "自画像",
- "封面",
- "取关",
- "美照",
- "随机照",
- "女装照",
- "日常照",
- "好友",
- "给主播",
- "照骗",
- "连麦",
- "情书",
- "一局",
- "舰涨优惠卷",
- "开黑",
- "test",
- "Test",
- "金币",
- "元宝",
- "代打",
- "上分",
- "上段",
- "台历",
- "一毛",
- "五毛",
- "王者荣耀",
- "玩游戏",
- "encrypt",
- "壁纸",
- "相片",
- "排位",
- "语音",
- "车位",
- "网剧",
- "一起玩",
- "一次",
- "专属头衔",
- "手游",
- "宠物",
- "蒸汽",
- "月饼",
- "加速",
- "挂件",
- "渔夫",
- "小黑屋",
- "头像",
- "许愿码",
- "电池",
- "赛车",
- "保底",
- "代币",
- "越南盾",
- "网点",
- "机器",
- "话梅",
- "志愿",
- "令牌",
- "永久",
- "第五人格",
- "大蒜",
- "唢呐",
- "皇冠",
- "徽章",
- "铜牌",
- "动物园",
- "植物",
- "钻石",
- "宝石",
- "尖叫",
- "扭蛋机",
- "点播",
- "数字版月历",
- "点歌一首",
- "体验",
- "点歌",
- "三次取关",
- "大航海",
- "3块钱之前的巨款",
- "礼金"
- ]
- },
- "CapsuleLottery": {
- "default": [
- "谢谢参与",
- "未中奖",
- "辣条"
- ]
- },
- "ActivityLottery": {
- "default": [
- "谢谢参与",
- "未中奖",
- "辣条"
- ]
- },
- "Notice": {
- "default": [
- "谢谢参与",
- "未中奖",
- "辣条"
- ]
- }
-}
\ No newline at end of file
diff --git a/data/latest_version.json b/data/latest_version.json
index 436c604..0d51103 100644
--- a/data/latest_version.json
+++ b/data/latest_version.json
@@ -5,7 +5,7 @@
"source": "https://github.com/lkeme/BiliHelper-personal",
"raw_url": "https://cdn.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest_version.json",
"purge_url": "https://purge.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest_version.json",
- "version": "0.9.4.210623",
+ "version": "0.9.5.210624",
"des": "程序有更新,请及时线上查看更新哦~",
- "time": "2021年6月23日21:40:35"
+ "time": "2021年6月24日11:40:35"
}
\ No newline at end of file
diff --git a/data/reply_words.json b/data/reply_words.json
new file mode 100644
index 0000000..1380ede
--- /dev/null
+++ b/data/reply_words.json
@@ -0,0 +1,175 @@
+{
+ "DynamicForward": {
+ "default": [
+ "从未中奖,从未放弃[doge]",
+ "来当分母= =",
+ "让我中一次吧QAQ",
+ "继续分母",
+ "转发动态",
+ "单纯想中次奖",
+ "我我我",
+ "不错",
+ "来了来了",
+ "爱了",
+ "(;¬_¬)",
+ "(~_~;)",
+ "= =!",
+ "╮(╯▽╰)╭",
+ "(シ_ _)シ",
+ ">_<",
+ "(๑• _ •๑)",
+ "(:3_ヽ)_",
+ "(⌒▽⌒)",
+ "(`・ω・´)",
+ "(◦˙▽˙◦)",
+ "(=・ω・=)",
+ "_Σ:з」∠)シ",
+ "o(∩_∩)o",
+ "(〜 ̄▽ ̄)〜",
+ "(๑• ▽ •๑)",
+ "哔哩哔哩干杯~",
+ "Bilibili 干杯~",
+ "bilibili 干杯~",
+ "[doge][doge][doge]",
+ "冲冲冲[打call][打call]",
+ "[doge]",
+ "万一可能呢",
+ "我的",
+ "[打call]",
+ "就看欧不欧啦",
+ "来了",
+ "中",
+ "好诶",
+ "好耶",
+ "拉低中奖率",
+ "重在拉低中奖率[doge]",
+ "分母",
+ "评论",
+ "成为一个分母,希望成为分子",
+ "[藏狐]我来",
+ "重在参与[OK]",
+ "就是我[给心心][打call]",
+ "抽起来!!!",
+ "我也要中奖",
+ "冲",
+ "[拥抱]",
+ "万一呢?",
+ "我来了",
+ "欧欧欧",
+ "冲冲冲",
+ "谢谢给我一个中奖的机会",
+ "奖励不重要,重要的是心[doge]",
+ "许愿",
+ "分母报道",
+ "大吉大利",
+ "欧气满满",
+ "不想再当分母",
+ "吸欧气",
+ "中!!!",
+ "",
+ "好运来",
+ "啊~",
+ "哈哈哈",
+ "抽奖奖(⌒▽⌒)",
+ "中奖绝缘体",
+ "绝缘体",
+ "求脱非入欧",
+ "好运",
+ "中奖绝缘体表示想中!",
+ "呜呜呜非洲人来了",
+ "选我吧",
+ "一定会中",
+ "好运bufff",
+ "滴滴滴",
+ "哇哇哇哇",
+ "万一呢",
+ "非酋日常",
+ "加油",
+ "抽中吧",
+ "我要",
+ "想欧一次!",
+ "拉低中奖率233",
+ "想要...",
+ "路过拉低中奖率",
+ "希望有个好运气",
+ "中奖",
+ "什么时候才会抽到我呢?",
+ "试试水,看看能不能中",
+ "过来水一手",
+ "这辈子都不可能中奖的",
+ "先拉低中奖率23333",
+ "先抽奖,抽不到再说",
+ "嘤嘤嘤",
+ "捞一把",
+ "我就想中一次",
+ "拉低拉低",
+ "试一试",
+ "搞一搞",
+ "中奖什么的不可能的( ̄▽ ̄)",
+ "听说我中奖了?",
+ "脱非转欧",
+ "emm",
+ "无聊.。。。。",
+ "[星星眼]",
+ "[妙啊]",
+ "[辣眼睛]",
+ "[吃瓜][吃瓜]",
+ "[滑稽]",
+ "[呲牙]",
+ "[打call][打call]",
+ "[哈欠][哈欠]",
+ "[吃瓜]不嫌事大",
+ "[口罩]",
+ "[思考]",
+ "[冷][冷][冷]",
+ "次次参加",
+ "从来没中过",
+ "让我中吧",
+ "来中个吧",
+ "送妹子多好",
+ "再送个小姐姐咋样",
+ "忍不住抽",
+ " (* ̄︶ ̄)",
+ "如影随形",
+ "参加够多就能中奖",
+ "参加够多就能当分子",
+ "[喜极而泣]",
+ "我是天选之子",
+ "中一次吧!",
+ "坚持不懈,迎难而上,开拓创新!",
+ "[OK][OK]",
+ "抽个奖和寂寞",
+ "中中",
+ "坚持不懈,迎难而上!",
+ "呵呵",
+ "我一般不抽奖,除非忍不住。",
+ "[OK]",
+ "[喜欢]",
+ "[偷笑]",
+ "[笑]",
+ "[吃瓜]",
+ "[奋斗]",
+ "在",
+ "冲吖~",
+ "[保佑][保佑]",
+ "从未中,从未停",
+ "[抠鼻][抠鼻]",
+ "来力",
+ "秋梨膏",
+ "从不缺席",
+ "分子",
+ "1",
+ "好",
+ "rush",
+ "来来来",
+ "ok",
+ "凑热闹",
+ "我要我要[打call]",
+ "我还能中!让我中!!!",
+ "大家都散了吧,已经抽完了,是我的",
+ "给我中一次吧!",
+ "我来抽个奖",
+ "[doge][doge][doge]"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/src/core/Curl.php b/src/core/Curl.php
index 6052dd0..c83bd5b 100644
--- a/src/core/Curl.php
+++ b/src/core/Curl.php
@@ -243,7 +243,7 @@ class Curl
'Connection' => 'keep-alive',
// 'Content-Type' => 'application/x-www-form-urlencoded',
// 'User-Agent' => 'Mozilla/5.0 BiliDroid/5.51.1 (bbcallen@gmail.com)',
- 'User-Agent' => 'Mozilla/5.0 BiliDroid/6.29.0 (bbcallen@gmail.com) os/android model/MuMu mobi_app/android build/6290300 channel/bili innerVer/6290300 osVer/7.1.2 network/2',
+ 'User-Agent' => 'Mozilla/5.0 BiliDroid/6.30.0 (bbcallen@gmail.com) os/android model/MuMu mobi_app/android build/6300400 channel/bili innerVer/6300400 osVer/7.1.2 network/2',
// 'Referer' => 'https://live.bilibili.com/',
];
$pc_headers = [
diff --git a/src/plugin/Dynamic.php b/src/plugin/Dynamic.php
index 69ac92a..29df509 100644
--- a/src/plugin/Dynamic.php
+++ b/src/plugin/Dynamic.php
@@ -9,9 +9,12 @@
namespace BiliHelper\Plugin;
use BiliHelper\Core\Curl;
+use BiliHelper\Util\FilterWords;
class Dynamic
{
+ use FilterWords;
+
// 228584 14027 434405 7019788 3230836
private static $topic_list = [
3230836 => '',
@@ -36,16 +39,22 @@ class Dynamic
// new
foreach ($data['data']['cards'] as $article) {
$article_id = $article['desc']['dynamic_id'];
+ // 获取 description
+ $card = json_decode($article['card'], true);
$item = [
'uid' => $article['desc']['uid'],
'rid' => $article['desc']['rid'],
'did' => $article_id,
'tm' => $article['desc']['timestamp'],
+ 'desc' => $card['item']['description']
];
-
+ // 过滤为true 就跳过
+ if (self::filterLayer($item)) continue;
+ // 不要原始desc
+ unset($item['desc']);
self::$article_list[$article_id] = $item;
}
-// $has_more = 0;
+ // $has_more = 0;
// more ??
// https://api.vc.bilibili.com/topic_svr/v1/topic_svr/topic_history?topic_name=转发抽奖&offset_dynamic_id=454347930068783808
}
@@ -62,7 +71,7 @@ class Dynamic
* @param string $extension
* @return bool
*/
- public static function dynamicRepost($rid, $content = "", $type = 1, $repost_code = 3000, $from = "create.comment", $extension = '{"emoji_type":1}'): bool
+ public static function dynamicRepost($rid, string $content = "", int $type = 1, int $repost_code = 3000, string $from = "create.comment", string $extension = '{"emoji_type":1}'): bool
{
$url = "https://api.vc.bilibili.com/dynamic_repost/v1/dynamic_repost/reply";
$payload = [
@@ -90,7 +99,7 @@ class Dynamic
* @param int $plat
* @return bool
*/
- public static function dynamicReplyAdd(int $rid, $message = "", $type = 11, $plat = 1): bool
+ public static function dynamicReplyAdd(int $rid, string $message = "", int $type = 11, int $plat = 1): bool
{
$url = "https://api.bilibili.com/x/v2/reply/add";
$payload = [
@@ -133,7 +142,7 @@ class Dynamic
* @param int $uid
* @return array
*/
- public static function getMyDynamic($uid = 0): array
+ public static function getMyDynamic(int $uid = 0): array
{
$uid = $uid == 0 ? getUid() : $uid;
$url = "https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/space_history";
@@ -197,7 +206,7 @@ class Dynamic
* @param int $type_list
* @return array|mixed
*/
- public static function getDynamicTab($uid = 0, $type_list = 268435455)
+ public static function getDynamicTab(int $uid = 0, int $type_list = 268435455)
{
$uid = $uid == 0 ? getUid() : $uid;
$url = "https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_new";
@@ -222,6 +231,33 @@ class Dynamic
}
}
return $card_list;
+ }
+ /**
+ * @use 过滤层
+ * @param array $item
+ * @return bool
+ */
+ protected static function filterLayer(array $item): bool
+ {
+ // 过滤描述
+ $default_words = self::$store->get("DynamicForward.default");
+ $custom_words = empty($words = getConf('filter_words', 'dynamic')) ? [] : explode(',', $words);
+ $total_words = array_merge($default_words, $custom_words);
+ foreach ($total_words as $word) {
+ if (strpos($item['desc'], $word) !== false) {
+ return true;
+ }
+ }
+ // 过滤UID
+ $uid_list = self::$store->get("Common.uid_list");
+ if (array_key_exists((int)$item['uid'], $uid_list)) {
+ return true;
+ }
+ // 过滤粉丝数量
+ if (Live::getMidFollower((int)$item['uid']) < getConf('min_fans_num', 'dynamic')) {
+ return true;
+ }
+ return false;
}
}
\ No newline at end of file
diff --git a/src/plugin/Forward.php b/src/plugin/Forward.php
index 173b854..a9ca109 100644
--- a/src/plugin/Forward.php
+++ b/src/plugin/Forward.php
@@ -21,6 +21,7 @@ namespace BiliHelper\Plugin;
use BiliHelper\Core\Log;
use BiliHelper\Util\TimeLock;
+use Noodlehaus\Config;
class Forward
{
@@ -37,10 +38,10 @@ class Forward
private static $group_id = null;
- private static $msg = '从未中奖,从未放弃[doge]';
-
private static $draw_follow = [];
+ private static $repository = APP_DATA_PATH . 'reply_words.json';
+
public static function run()
{
@@ -59,10 +60,6 @@ class Forward
public static function start(): bool
{
- //更改自动回复
- if (getConf('auto_reply_text', 'dynamic') != self::$msg) {
- self::changeReply();
- }
// 取关未中奖
if (getConf('clear_group_follow', 'dynamic')) {
self::clearDynamic();
@@ -79,16 +76,6 @@ class Forward
return true;
}
- /**
- *更改自动回复
- */
- public static function changeReply()
- {
- self::$msg = getConf('auto_reply_text', 'dynamic');
- $msg = self::$msg;
- Log::info("已将自动回复改为\"{$msg}\"");
- }
-
/**
* 自动转发抽奖
*/
@@ -104,10 +91,10 @@ class Forward
}
// 评论
Log::info("[动态抽奖]-评论: {$did} {$article['rid']}");
- if (Dynamic::dynamicReplyAdd($article['rid'], self::$msg)) {
+ if (Dynamic::dynamicReplyAdd($article['rid'], self::getReplyMsg())) {
// 转发
Log::info("[动态抽奖]-转发: {$did}");
- if (Dynamic::dynamicRepost($did, self::$msg)) {
+ if (Dynamic::dynamicRepost($did, self::getReplyMsg())) {
// 关注
Log::info("[动态抽奖]-关注: {$did} {$article['uid']}");
self::addToGroup($article['uid']); //
@@ -219,12 +206,15 @@ class Forward
private static function clearAllDynamic()
{
$dynamicList = Dynamic::getMyDynamic();
+ $msg_list = self::getReplyMsgList();
foreach ($dynamicList as $dynamic) {
$did = $dynamic['desc']['dynamic_id'];
$card = json_decode($dynamic['card'], true);
- if (strpos($card['item']['content'], self::$msg) !== false) {
- Log::info("[删除所有动态] 删除动态 {$did}");
- Dynamic::removeDynamic($did);
+ foreach ($msg_list as $msg) {
+ if (strpos($card['item']['content'], $msg) !== false) {
+ Log::info("[删除所有动态] 删除动态 {$did}");
+ Dynamic::removeDynamic($did);
+ }
}
}
}
@@ -242,7 +232,7 @@ class Forward
$tags = User::fetchTags();
$tag_id = array_search(self::$group_name, $tags);
// 如果不存在则调用创建
- self::$group_id = $tag_id ? $tag_id : User::createRelationTag(self::$group_name);
+ self::$group_id = $tag_id ?: User::createRelationTag(self::$group_name);
}
// 是否在关注里
$default_follows = self::getDefaultFollows();
@@ -269,4 +259,34 @@ class Forward
}
return self::$default_follows;
}
+
+ /**
+ * @use 获取回复 all
+ * @return array
+ */
+ private static function getReplyMsgList(): array
+ {
+ $data = Config::load(self::$repository);
+ $data = $data->get("DynamicForward.default");
+ array_push($data, getConf('auto_reply_text', 'dynamic'));
+ return $data;
+ }
+
+ /**
+ * @use 获取回复 1
+ * @return string
+ */
+ private static function getReplyMsg(): string
+ {
+ //更改自动回复
+ if (getConf('auto_reply_text', 'dynamic') != '') {
+ $msg = getConf('auto_reply_text', 'dynamic');
+ } else {
+ $data = self::getReplyMsgList();
+ shuffle($data);
+ $msg = array_pop($data);
+ }
+ Log::info("已将自动回复改为\"{$msg}\"");
+ }
+
}
diff --git a/src/plugin/Live.php b/src/plugin/Live.php
index 834eb44..2734a3a 100644
--- a/src/plugin/Live.php
+++ b/src/plugin/Live.php
@@ -432,4 +432,39 @@ class Live
}
return $room_ids;
}
+
+ /**
+ * @use 获取用户卡片
+ * @param int $mid
+ * @return array
+ */
+ public static function getMidCard(int $mid): array
+ {
+ $url = 'https://api.bilibili.com/x/web-interface/card';
+ $payload = [
+ 'mid' => $mid,
+ ];
+ //{"code":0,"message":"0","ttl":1,"data":{"card":{"mid":"1","name":"bishi","approve":false,"sex":"男","rank":"10000","face":"http://i1.hdslb.com/bfs/face/34c5b30a990c7ce4a809626d8153fa7895ec7b63.gif","DisplayRank":"0","regtime":0,"spacesta":0,"birthday":"","place":"","description":"","article":0,"attentions":[],"fans":154167,"friend":5,"attention":5,"sign":"","level_info":{"current_level":4,"current_min":0,"current_exp":0,"next_exp":0},"pendant":{"pid":0,"name":"","image":"","expire":0,"image_enhance":"","image_enhance_frame":""},"nameplate":{"nid":0,"name":"","image":"","image_small":"","level":"","condition":""},"Official":{"role":0,"title":"","desc":"","type":-1},"official_verify":{"type":-1,"desc":""},"vip":{"type":2,"status":1,"due_date":1727625600000,"vip_pay_type":1,"theme_type":0,"label":{"path":"","text":"年度大会员","label_theme":"annual_vip","text_color":"#FFFFFF","bg_style":1,"bg_color":"#FB7299","border_color":""},"avatar_subscript":1,"nickname_color":"#FB7299","role":3,"avatar_subscript_url":"http://i0.hdslb.com/bfs/vip/icon_Certification_big_member_22_3x.png","vipType":2,"vipStatus":1}},"following":false,"archive_count":2,"article_count":0,"follower":154167}}
+ $raw = Curl::get('other', $url, $payload);
+ return json_decode($raw, true);
+ }
+
+ /**
+ * @use 获取用户关注数
+ * @param int $mid
+ * @return int
+ */
+ public static function getMidFollower(int $mid): int
+ {
+ $follower = 0;
+ // root->data->follower
+ $data = self::getMidCard($mid);
+ if (isset($data['code']) && $data['code']) {
+ Log::warning("获取用户资料卡片失败: CODE -> {$data['code']} MSG -> {$data['message']} ");
+ } else {
+ // root->data->follower
+ $follower = $data['data']['follower'];
+ }
+ return $follower;
+ }
}
diff --git a/src/plugin/Sign.php b/src/plugin/Sign.php
index 4562eed..ae26d56 100644
--- a/src/plugin/Sign.php
+++ b/src/plugin/Sign.php
@@ -55,7 +55,7 @@ class Sign
'access_key' => getConf('access_token', 'login.auth'),
'actionKey' => 'appkey',
'appkey' => $appkey,
- 'build' => 6290300,
+ 'build' => 6300400,
'channel' => 'bili',
'device' => 'phone',
'mobi_app' => 'android',
@@ -84,7 +84,7 @@ class Sign
'access_key' => getConf('access_token', 'login.auth'),
'actionKey' => 'appkey',
'appkey' => $appkey,
- 'build' => 6290300,
+ 'build' => 6300400,
'device' => 'phone',
'mobi_app' => 'android',
'platform' => 'android',
diff --git a/src/util/FilterWords.php b/src/util/FilterWords.php
index 2bd744d..faac7b2 100644
--- a/src/util/FilterWords.php
+++ b/src/util/FilterWords.php
@@ -18,7 +18,7 @@ trait FilterWords
{
protected static $store;
protected static $store_status;
- protected static $repository = APP_DATA_PATH . 'filter_words.json';
+ protected static $repository = APP_DATA_PATH . 'filter_library.json';
/**
* @use 加载配置信息
From 70054f74301e0ab67096ea248bb0f03c7e1f51e5 Mon Sep 17 00:00:00 2001
From: Lkeme <19500576+lkeme@users.noreply.github.com>
Date: Thu, 24 Jun 2021 17:53:16 +0800
Subject: [PATCH 22/28] [fix] Dynamic
---
src/plugin/Dynamic.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/plugin/Dynamic.php b/src/plugin/Dynamic.php
index 29df509..9cd632b 100644
--- a/src/plugin/Dynamic.php
+++ b/src/plugin/Dynamic.php
@@ -240,6 +240,7 @@ class Dynamic
*/
protected static function filterLayer(array $item): bool
{
+ self::loadJsonData();
// 过滤描述
$default_words = self::$store->get("DynamicForward.default");
$custom_words = empty($words = getConf('filter_words', 'dynamic')) ? [] : explode(',', $words);
From b2005b1ad67cc416f24a7ec5100a676250834f15 Mon Sep 17 00:00:00 2001
From: Lkeme <19500576+lkeme@users.noreply.github.com>
Date: Fri, 25 Jun 2021 10:57:27 +0800
Subject: [PATCH 23/28] [fix] Dynamic fixed #92
---
CHANGELOG.md | 25 ++++++++++++++
README.md | 70 ++++++++++++++++++++--------------------
composer.lock | 10 +++---
conf/user.ini.example | 4 +++
data/filter_library.json | 32 +-----------------
data/latest_version.json | 4 +--
src/plugin/Dynamic.php | 30 +++++++++++++++--
src/plugin/Live.php | 23 ++++++++++++-
src/plugin/Login.php | 4 ++-
9 files changed, 124 insertions(+), 78 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6c1ecd2..15080ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,31 @@
# 本项目Log
+
+
+## v0.9.6.210625 alpha (2021-06-25)
+
+### Added
+
+-
+
+### Changed
+
+- 优化动态过滤
+- 优化过滤关键字
+- 优化短信登录流程
+-
+
+### Fixed
+
+- 修复动态转发
+-
+
+### Remarks
+
+- 注意配置文件有些许改动
+-
+
## v0.9.5.210624 alpha (2021-06-24)
### Added
diff --git a/README.md b/README.md
index 3221ea6..022ba53 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@
-
+
@@ -37,40 +37,40 @@
| plugin | status | version | description |
|-----------------|--------|----------|---------------------------------------------|
-| CheckUpdate | true | 21.06.24 | 程序检查更新 |
-| Login | true | 21.06.24 | 账号登录、刷新、维持 |
-| Schedule | true | 21.06.24 | 控制插件运行周期 |
-| MainSite | true | 21.06.24 | 投币、观看、分享视频 (速升6级不是梦) |
-| DailyBag | true | 21.06.24 | 双端领取日常/周常礼包 |
-| ManGa | true | 21.06.24 | 漫画签到、分享 |
-| ActivityLottery | true | 21.06.24 | 主站活动九宫格抽奖 |
-| Competition | true | 21.06.24 | 游戏赛事竞猜 |
-| DoubleHeart | true | 21.06.24 | 双端心跳 (姥爷直播经验) |
-| DailyTask | true | 21.06.24 | 直播每日任务(签到、观看) |
-| Barrage | true | 21.06.24 | 保持活跃弹幕 |
-| Silver2Coin | true | 21.06.24 | 银瓜子兑换硬币 |
-| Judge | true | 21.06.24 | 风纪委员投票 |
-| GiftSend | true | 21.06.24 | 礼物赠送、维持每日勋章亲密度 |
-| GroupSignIn | true | 21.06.24 | 友爱社签到 |
-| GiftHeart | true | 21.06.24 | 日常心跳每日礼包礼物 |
-| SmallHeart | true | 21.06.24 | 直播挂机,每日24个小心心 |
-| MaterialObject | true | 21.06.24 | 直播金色宝箱实物抽奖 |
-| AloneTcpClient | true | 21.06.24 | 作者的独立直播监控(可支持本项目哦) |
-| ZoneTcpClient | true | 21.06.24 | 官方的分区直播监控 |
-| StormRaffle | true | 21.06.24 | 直播节奏风暴抽奖、亿元 |
-| GiftRaffle | true | 21.06.24 | 直播礼物抽奖 |
-| PkRaffle | true | 21.06.24 | 直播大乱斗抽奖 |
-| GuardRaffle | true | 21.06.24 | 直播大航海抽奖 |
-| AnchorRaffle | true | 21.06.24 | 直播天选时刻抽奖 |
-| GiftRaffle | true | 21.06.24 | 直播礼物抽奖 |
-| AwardRecord | true | 21.06.24 | 最新的中奖纪录通知 |
-| Forward | true | 21.06.24 | 主站动态抽奖转发 |
-| CapsuleLottery | true | 21.06.24 | 直播扭蛋活动抽奖 |
-| PolishTheMedal | true | 21.06.24 | 每日自动点亮灰色勋章 |
-| CapsuleLottery | true | 21.06.24 | 直播扭蛋活动抽奖 |
-| VipPrivilege | true | 21.06.24 | 每月领取年度大会员特权(B币券、会员购优惠券) |
-| BpConsumption | true | 21.06.24 | 每月消费使用年度大会员特权的B币券 |
-| Statistics | true | 21.06.24 | 全局抽奖结果统计 |
+| CheckUpdate | true | 21.06.25 | 程序检查更新 |
+| Login | true | 21.06.25 | 账号登录、刷新、维持 |
+| Schedule | true | 21.06.25 | 控制插件运行周期 |
+| MainSite | true | 21.06.25 | 投币、观看、分享视频 (速升6级不是梦) |
+| DailyBag | true | 21.06.25 | 双端领取日常/周常礼包 |
+| ManGa | true | 21.06.25 | 漫画签到、分享 |
+| ActivityLottery | true | 21.06.25 | 主站活动九宫格抽奖 |
+| Competition | true | 21.06.25 | 游戏赛事竞猜 |
+| DoubleHeart | true | 21.06.25 | 双端心跳 (姥爷直播经验) |
+| DailyTask | true | 21.06.25 | 直播每日任务(签到、观看) |
+| Barrage | true | 21.06.25 | 保持活跃弹幕 |
+| Silver2Coin | true | 21.06.25 | 银瓜子兑换硬币 |
+| Judge | true | 21.06.25 | 风纪委员投票 |
+| GiftSend | true | 21.06.25 | 礼物赠送、维持每日勋章亲密度 |
+| GroupSignIn | true | 21.06.25 | 友爱社签到 |
+| GiftHeart | true | 21.06.25 | 日常心跳每日礼包礼物 |
+| SmallHeart | true | 21.06.25 | 直播挂机,每日24个小心心 |
+| MaterialObject | true | 21.06.25 | 直播金色宝箱实物抽奖 |
+| AloneTcpClient | true | 21.06.25 | 作者的独立直播监控(可支持本项目哦) |
+| ZoneTcpClient | true | 21.06.25 | 官方的分区直播监控 |
+| StormRaffle | true | 21.06.25 | 直播节奏风暴抽奖、亿元 |
+| GiftRaffle | true | 21.06.25 | 直播礼物抽奖 |
+| PkRaffle | true | 21.06.25 | 直播大乱斗抽奖 |
+| GuardRaffle | true | 21.06.25 | 直播大航海抽奖 |
+| AnchorRaffle | true | 21.06.25 | 直播天选时刻抽奖 |
+| GiftRaffle | true | 21.06.25 | 直播礼物抽奖 |
+| AwardRecord | true | 21.06.25 | 最新的中奖纪录通知 |
+| Forward | true | 21.06.25 | 主站动态抽奖转发 |
+| CapsuleLottery | true | 21.06.25 | 直播扭蛋活动抽奖 |
+| PolishTheMedal | true | 21.06.25 | 每日自动点亮灰色勋章 |
+| CapsuleLottery | true | 21.06.25 | 直播扭蛋活动抽奖 |
+| VipPrivilege | true | 21.06.25 | 每月领取年度大会员特权(B币券、会员购优惠券) |
+| BpConsumption | true | 21.06.25 | 每月消费使用年度大会员特权的B币券 |
+| Statistics | true | 21.06.25 | 全局抽奖结果统计 |
| Silver | false | 21.03.27 | 直播银瓜子自动开启宝箱 |
## 交流反馈
diff --git a/composer.lock b/composer.lock
index 8deaef9..62ecc11 100644
--- a/composer.lock
+++ b/composer.lock
@@ -892,16 +892,16 @@
},
{
"name": "laminas/laminas-zendframework-bridge",
- "version": "1.2.0",
+ "version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/laminas/laminas-zendframework-bridge.git",
- "reference": "6cccbddfcfc742eb02158d6137ca5687d92cee32"
+ "reference": "13af2502d9bb6f7d33be2de4b51fb68c6cdb476e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/6cccbddfcfc742eb02158d6137ca5687d92cee32",
- "reference": "6cccbddfcfc742eb02158d6137ca5687d92cee32",
+ "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/13af2502d9bb6f7d33be2de4b51fb68c6cdb476e",
+ "reference": "13af2502d9bb6f7d33be2de4b51fb68c6cdb476e",
"shasum": "",
"mirrors": [
{
@@ -956,7 +956,7 @@
"type": "community_bridge"
}
],
- "time": "2021-02-25T21:54:58+00:00"
+ "time": "2021-06-24T12:49:22+00:00"
},
{
"name": "lkeme/inifile",
diff --git a/conf/user.ini.example b/conf/user.ini.example
index 2e355d1..2c5dc91 100644
--- a/conf/user.ini.example
+++ b/conf/user.ini.example
@@ -11,6 +11,10 @@ password = ""
[login.mode]
mode = 1
+; 校验|mode=2触发|校验国内手机号|国外手机号关闭校验
+[login.check]
+phone = true
+
; UID|CSRF|令牌|(当前区域自动生成)
[login.auth]
uid =
diff --git a/data/filter_library.json b/data/filter_library.json
index b74ef81..f2215bc 100644
--- a/data/filter_library.json
+++ b/data/filter_library.json
@@ -77,7 +77,6 @@
"无奖品",
"白名单",
"我是抽奖",
- "0.1",
"五毛二",
"一分",
"一毛",
@@ -342,7 +341,6 @@
"全部答对",
"弹幕",
"评论下方投稿视频",
- "征集",
"炸鱼",
"黑屋",
"照片",
@@ -421,23 +419,19 @@
"TEST",
"钓鱼",
"炸鱼",
- "调试"
- ],
- "sensitive": [
+ "调试",
"编曲",
"作词",
"半价",
"打折",
"机器",
"禁言",
- "测试",
"vcf",
"体验中奖",
"中奖的感觉",
"录歌",
"混音",
"一毛",
- "0.1元",
"1角",
"0.5元",
"5毛",
@@ -445,7 +439,6 @@
"感脚",
"曲风",
"专辑封面",
- "封面",
"一元红包",
"感jio",
"名片赞",
@@ -474,12 +467,9 @@
"内容自定",
"音乐人一个",
"私人唱歌",
- "感恩",
"作业",
"八字",
"算命",
- "电台",
- "情感视频",
"万兴神剪手",
"学习修图",
"写一首歌",
@@ -499,13 +489,10 @@
"定制beat",
"定制logo",
"惊喜软件",
- "终于中奖",
"加群",
"第一批粉丝",
- "祝大家",
"内部群",
"老粉",
- "仅关注",
"仅我关注",
"打字粉丝ID",
"手打粉丝ID",
@@ -526,7 +513,6 @@
"专辑",
"励志的话",
"亲笔签名",
- "up",
"扫码进群",
"粉丝群",
"签名写真",
@@ -534,11 +520,8 @@
"祝你",
"红包雨",
"电子书",
- "我",
"好友位",
"豪车优惠",
- "观众老爷",
- "的支持",
"星段位",
"圣晶石",
"水晶",
@@ -555,21 +538,16 @@
"第一波",
"第二波",
"策是",
- "我是抽奖",
"照片",
"穷",
"0.5",
"一角",
"冥币",
"加速器",
- "硬币",
"无奖品",
"白名单",
- "奖品B",
- "奖品C",
"五毛",
"第三波",
- "0.1",
"五毛二",
"一分",
"0.52",
@@ -588,7 +566,6 @@
"自拍",
"日历",
"0.22",
- "房间抽奖",
"CESHI",
"奖品A",
"抽奖标题",
@@ -603,7 +580,6 @@
"buff",
"头像",
"剩的",
- "中奖的",
"Ziyoda",
"Hilola",
"beden",
@@ -611,9 +587,7 @@
"采样",
"音频",
"海报",
- "关注",
"粉丝ID",
- "优惠券",
"微博",
"互粉",
"真心话",
@@ -629,14 +603,11 @@
"什么都",
"什么也",
"这不是抽奖",
- "真欧",
- "很欧",
"使用权",
"曲谱",
"啥也没有",
"木有",
"车载音乐",
- "中奖滴",
"会员歌曲",
"一首歌",
"必唱",
@@ -644,7 +615,6 @@
"词作",
"购买资格",
"粉群",
- "优惠",
"折扣",
"hoholive",
"surat",
diff --git a/data/latest_version.json b/data/latest_version.json
index 0d51103..d964f18 100644
--- a/data/latest_version.json
+++ b/data/latest_version.json
@@ -5,7 +5,7 @@
"source": "https://github.com/lkeme/BiliHelper-personal",
"raw_url": "https://cdn.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest_version.json",
"purge_url": "https://purge.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest_version.json",
- "version": "0.9.5.210624",
+ "version": "0.9.6.210625",
"des": "程序有更新,请及时线上查看更新哦~",
- "time": "2021年6月24日11:40:35"
+ "time": "2021年6月25日11:40:35"
}
\ No newline at end of file
diff --git a/src/plugin/Dynamic.php b/src/plugin/Dynamic.php
index 9cd632b..114dea5 100644
--- a/src/plugin/Dynamic.php
+++ b/src/plugin/Dynamic.php
@@ -9,12 +9,18 @@
namespace BiliHelper\Plugin;
use BiliHelper\Core\Curl;
+use BiliHelper\Core\Log;
use BiliHelper\Util\FilterWords;
class Dynamic
{
use FilterWords;
+ // TODO 活动订阅
+ // https://www.bilibili.com/blackboard/activity-WeqT10t1ep.html
+ // https://api.vc.bilibili.com/topic_svr/v1/topic_svr/fetch_dynamics?topic_name=%E4%BA%92%E5%8A%A8%E6%8A%BD%E5%A5%96&sortby=2
+ private static $tags = ['互动抽奖', '抽奖', '转发抽奖', '动态抽奖', '关注+转发'];
+
// 228584 14027 434405 7019788 3230836
private static $topic_list = [
3230836 => '',
@@ -41,12 +47,25 @@ class Dynamic
$article_id = $article['desc']['dynamic_id'];
// 获取 description
$card = json_decode($article['card'], true);
+ if (array_key_exists("description", $card['item'])) {
+ // 主动态
+ $description = $card['item']['description'];
+ } elseif (array_key_exists("content", $card['item'])) {
+ // 子动态
+ // TODO 暂时跳过 需要合适的处理方法
+ // description = $card['item']['content'];
+ continue;
+ } else {
+ // 链接到视频的动态 少数 跳过
+ // print_r($card);
+ continue;
+ }
$item = [
'uid' => $article['desc']['uid'],
'rid' => $article['desc']['rid'],
'did' => $article_id,
'tm' => $article['desc']['timestamp'],
- 'desc' => $card['item']['description']
+ 'desc' => $description
];
// 过滤为true 就跳过
if (self::filterLayer($item)) continue;
@@ -58,6 +77,7 @@ class Dynamic
// more ??
// https://api.vc.bilibili.com/topic_svr/v1/topic_svr/topic_history?topic_name=转发抽奖&offset_dynamic_id=454347930068783808
}
+ print_r(count(self::$article_list));
return self::$article_list;
}
@@ -243,20 +263,24 @@ class Dynamic
self::loadJsonData();
// 过滤描述
$default_words = self::$store->get("DynamicForward.default");
+ $common_words = self::$store->get("Common.default");
$custom_words = empty($words = getConf('filter_words', 'dynamic')) ? [] : explode(',', $words);
- $total_words = array_merge($default_words, $custom_words);
+ $total_words = array_merge($default_words, $custom_words, $common_words);
foreach ($total_words as $word) {
if (strpos($item['desc'], $word) !== false) {
+ Log::warning("当前动态#{$item['did']}触发关键字过滤 {$word}");
return true;
}
}
// 过滤UID
$uid_list = self::$store->get("Common.uid_list");
if (array_key_exists((int)$item['uid'], $uid_list)) {
+ Log::warning("当前动态#{$item['did']}触发UP黑名单过滤 {$item['uid']}");
return true;
}
// 过滤粉丝数量
- if (Live::getMidFollower((int)$item['uid']) < getConf('min_fans_num', 'dynamic')) {
+ if (($num = Live::getMidFollower((int)$item['uid'])) < getConf('min_fans_num', 'dynamic')) {
+ Log::warning("当前动态#{$item['did']}触发UP粉丝数量过滤 {$num}");
return true;
}
return false;
diff --git a/src/plugin/Live.php b/src/plugin/Live.php
index 2734a3a..28d7978 100644
--- a/src/plugin/Live.php
+++ b/src/plugin/Live.php
@@ -449,6 +449,22 @@ class Live
return json_decode($raw, true);
}
+ /**
+ * @use 获取用户状态
+ * @param int $mid
+ * @return array
+ */
+ public static function getMidStat(int $mid): array
+ {
+ $url = 'https://api.bilibili.com/x/relation/stat';
+ $payload = [
+ 'vmid' => $mid,
+ ];
+ // {"code":0,"message":"0","ttl":1,"data":{"mid":50329118,"following":62,"whisper":0,"black":0,"follower":7610241}}
+ $raw = Curl::get('other', $url, $payload);
+ return json_decode($raw, true);
+ }
+
/**
* @use 获取用户关注数
* @param int $mid
@@ -458,7 +474,12 @@ class Live
{
$follower = 0;
// root->data->follower
- $data = self::getMidCard($mid);
+ if (mt_rand(0, 10) > 5) {
+ $data = self::getMidStat($mid);
+ } else {
+ $data = self::getMidCard($mid);
+ }
+
if (isset($data['code']) && $data['code']) {
Log::warning("获取用户资料卡片失败: CODE -> {$data['code']} MSG -> {$data['message']} ");
} else {
diff --git a/src/plugin/Login.php b/src/plugin/Login.php
index eda4367..8f2b1e5 100644
--- a/src/plugin/Login.php
+++ b/src/plugin/Login.php
@@ -270,7 +270,9 @@ class Login
private static function smsLogin(string $mode = '短信模式')
{
Log::info("尝试 {$mode} 登录");
- self::checkPhone(self::$username);
+ if (getConf('phone', 'login.check')) {
+ self::checkPhone(self::$username);
+ }
$captcha = self::sendSms(self::$username);
$url = 'https://passport.bilibili.com/x/passport-login/login/sms';
$payload = [
From fd670bbe3e85d8ba34a45a6f188e5cb72e632b5e Mon Sep 17 00:00:00 2001
From: Lkeme <19500576+lkeme@users.noreply.github.com>
Date: Fri, 25 Jun 2021 11:49:28 +0800
Subject: [PATCH 24/28] [fix] Forward
---
conf/user.ini.example | 2 +-
data/filter_library.json | 4 +++-
src/plugin/Forward.php | 1 +
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/conf/user.ini.example b/conf/user.ini.example
index 2c5dc91..028f3ed 100644
--- a/conf/user.ini.example
+++ b/conf/user.ini.example
@@ -145,7 +145,7 @@ bp2gold = false
enable = false
clear_dynamic = false
clear_group_follow = false
-min_fans_num = 1001
+min_fans_num = 4999
auto_reply_text =
filter_words =
diff --git a/data/filter_library.json b/data/filter_library.json
index f2215bc..efabfbe 100644
--- a/data/filter_library.json
+++ b/data/filter_library.json
@@ -637,7 +637,9 @@
"无损wav",
"mp3使用权",
"wav使用权",
- "曲谱"
+ "曲谱",
+ "抽个寂寞",
+ "儿子"
],
"uid_list": [
28008897,
diff --git a/src/plugin/Forward.php b/src/plugin/Forward.php
index a9ca109..14e3e41 100644
--- a/src/plugin/Forward.php
+++ b/src/plugin/Forward.php
@@ -287,6 +287,7 @@ class Forward
$msg = array_pop($data);
}
Log::info("已将自动回复改为\"{$msg}\"");
+ return $msg;
}
}
From 8f25c37912df256669e8471d5f45cfd771fabe9a Mon Sep 17 00:00:00 2001
From: Lkeme <19500576+lkeme@users.noreply.github.com>
Date: Tue, 6 Jul 2021 16:25:46 +0800
Subject: [PATCH 25/28] [update] Login
---
conf/user.ini.example | 4 ++++
src/core/Curl.php | 2 +-
src/plugin/Login.php | 4 ++--
src/plugin/MainSite.php | 8 ++++++--
src/plugin/Sign.php | 4 ++--
5 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/conf/user.ini.example b/conf/user.ini.example
index 028f3ed..eb1e4dd 100644
--- a/conf/user.ini.example
+++ b/conf/user.ini.example
@@ -11,6 +11,10 @@ password = ""
[login.mode]
mode = 1
+; 国家代码|mode=2触发|例:大陆86 澳大利亚61
+[login.country]
+country_code = 86
+
; 校验|mode=2触发|校验国内手机号|国外手机号关闭校验
[login.check]
phone = true
diff --git a/src/core/Curl.php b/src/core/Curl.php
index c83bd5b..2a7e19e 100644
--- a/src/core/Curl.php
+++ b/src/core/Curl.php
@@ -243,7 +243,7 @@ class Curl
'Connection' => 'keep-alive',
// 'Content-Type' => 'application/x-www-form-urlencoded',
// 'User-Agent' => 'Mozilla/5.0 BiliDroid/5.51.1 (bbcallen@gmail.com)',
- 'User-Agent' => 'Mozilla/5.0 BiliDroid/6.30.0 (bbcallen@gmail.com) os/android model/MuMu mobi_app/android build/6300400 channel/bili innerVer/6300400 osVer/7.1.2 network/2',
+ 'User-Agent' => 'Mozilla/5.0 BiliDroid/6.31.0 (bbcallen@gmail.com) os/android model/MuMu mobi_app/android build/6310200 channel/bili innerVer/6310200 osVer/7.1.2 network/2',
// 'Referer' => 'https://live.bilibili.com/',
];
$pc_headers = [
diff --git a/src/plugin/Login.php b/src/plugin/Login.php
index 8f2b1e5..7f52d03 100644
--- a/src/plugin/Login.php
+++ b/src/plugin/Login.php
@@ -311,9 +311,9 @@ class Login
{
$url = 'https://passport.bilibili.com//x/passport-login/sms/send';
$payload = [
- 'cid' => '86',
+ 'cid' => getConf('country_code', 'login.country') ,
'tel' => $phone,
- 'statistics' => '{"appId":1,"platform":3,"version":"6.3.0","abtest":""}',
+ 'statistics' => '{"appId":1,"platform":3,"version":"6.31.0","abtest":""}',
];
$raw = Curl::post('app', $url, Sign::login($payload));
$de_raw = json_decode($raw, true);
diff --git a/src/plugin/MainSite.php b/src/plugin/MainSite.php
index dac6dd6..c684c05 100644
--- a/src/plugin/MainSite.php
+++ b/src/plugin/MainSite.php
@@ -151,7 +151,7 @@ class MainSite
$de_raw = json_decode($raw, true);
// echo "getRandomAid " . count($de_raw['data']['archives']) . PHP_EOL;
// $aid = array_rand($de_raw['data']['archives'])['aid'];
- } while (count($de_raw['data']['archives']) == 0);
+ } while (count((array)$de_raw['data']['archives']) == 0);
$aid = $de_raw['data']['archives'][0]['aid'];
return (string)$aid;
}
@@ -243,7 +243,11 @@ class MainSite
$raw = Curl::get('other', $url, $payload);
$de_raw = json_decode($raw, true);
if ($de_raw['code'] == 0) {
- $temps = array_rand($de_raw['data']['archives'], $num);
+ if ($num == 1) {
+ $temps = [array_rand($de_raw['data']['archives'], $num)];
+ } else {
+ $temps = array_rand($de_raw['data']['archives'], $num);
+ }
foreach ($temps as $temp) {
array_push($aids, $de_raw['data']['archives'][$temp]['aid']);
}
diff --git a/src/plugin/Sign.php b/src/plugin/Sign.php
index ae26d56..45be081 100644
--- a/src/plugin/Sign.php
+++ b/src/plugin/Sign.php
@@ -55,7 +55,7 @@ class Sign
'access_key' => getConf('access_token', 'login.auth'),
'actionKey' => 'appkey',
'appkey' => $appkey,
- 'build' => 6300400,
+ 'build' => 6310200,
'channel' => 'bili',
'device' => 'phone',
'mobi_app' => 'android',
@@ -84,7 +84,7 @@ class Sign
'access_key' => getConf('access_token', 'login.auth'),
'actionKey' => 'appkey',
'appkey' => $appkey,
- 'build' => 6300400,
+ 'build' => 6310200,
'device' => 'phone',
'mobi_app' => 'android',
'platform' => 'android',
From ba9beddfd1b1bf72bb9a6d38873c568133bf6a43 Mon Sep 17 00:00:00 2001
From: poly000 <34085039+poly000@users.noreply.github.com>
Date: Fri, 9 Jul 2021 05:25:26 +0800
Subject: [PATCH 26/28] Update filter_library.json
---
data/filter_library.json | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/data/filter_library.json b/data/filter_library.json
index efabfbe..9c943ec 100644
--- a/data/filter_library.json
+++ b/data/filter_library.json
@@ -5,7 +5,8 @@
"加密",
"test",
"TEST",
- "钓鱼",
+ "钓",
+ "实验",
"炸鱼",
"调试",
"123",
@@ -722,4 +723,4 @@
501312931
]
}
-}
\ No newline at end of file
+}
From 1ef8264f2098c6e7c6b425a0f9fa158e26cd3d40 Mon Sep 17 00:00:00 2001
From: Lkeme <19500576+lkeme@users.noreply.github.com>
Date: Wed, 14 Jul 2021 11:05:20 +0800
Subject: [PATCH 27/28] [add] Script Mode
---
.gitignore | 4 +-
CHANGELOG.md | 26 +++
README.md | 84 +++----
composer.json | 6 +-
composer.lock | 163 ++++++++++++--
conf/user.ini.example | 2 +-
data/filter_library.json | 3 +-
data/latest_version.json | 4 +-
index.php | 5 +-
src/core/App.php | 59 ++++-
src/core/Command.php | 52 +++++
src/core/Curl.php | 2 +-
src/core/Helpers.php | 11 +
src/core/HttpClient.php | 159 ++++++++++++++
src/plugin/Barrage.php | 2 +-
src/plugin/CapsuleLottery.php | 2 +-
src/plugin/CheckUpdate.php | 2 +-
src/plugin/DataTreating.php | 2 +-
src/plugin/Dynamic.php | 4 +-
src/plugin/GroupSignIn.php | 2 +-
src/plugin/Judge.php | 2 +-
src/plugin/Login.php | 10 +-
src/plugin/ManGa.php | 2 +-
src/plugin/MaterialObject.php | 2 +-
src/plugin/Schedule.php | 2 +-
src/plugin/Sign.php | 10 +-
src/plugin/Statistics.php | 2 +-
src/plugin/ZoneTcpClient.php | 2 +-
src/script/BaseTask.php | 63 ++++++
src/script/DelDynamic.php | 22 ++
src/script/UnFollow.php | 146 +++++++++++++
src/script/User.php | 57 +++++
src/tool/UserAgent.php | 401 ++++++++++++++++++++++++++++++++++
src/util/BaseRaffle.php | 6 +-
34 files changed, 1221 insertions(+), 100 deletions(-)
create mode 100644 src/core/Command.php
create mode 100644 src/core/HttpClient.php
create mode 100644 src/script/BaseTask.php
create mode 100644 src/script/DelDynamic.php
create mode 100644 src/script/UnFollow.php
create mode 100644 src/script/User.php
create mode 100644 src/tool/UserAgent.php
diff --git a/.gitignore b/.gitignore
index c598a49..e72cf9c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,10 +28,12 @@ conf/user1.ini
/conf/test1.ini
/log/
/src/backup/
+script.php
# ignore all files in lib/
task/*
# except for .gitkeep
!.gitkeep
# ignore TODO file in root directory,not subdir/TODO
-/TODO
\ No newline at end of file
+/TODO
+/Todo
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 15080ab..aff8c0f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,33 @@
# 本项目Log
+[comment]: <> (
更新历史latest
)
+
+[comment]: <> (
-
+
@@ -30,48 +31,53 @@
---- 免费的东西总是得不到人的珍惜。
---- 只有花大价钱去买到的东西,才会令人信任。
```
+## 🖥️星图
+
+[](https://starchart.cc/lkeme/BiliHelper-personal)
+[](https://starchart.cc/lkeme/BiliHelper)
## 功能组件
以下任务都是按设定周期自动执行,`true`为正常使用,`false`为暂停使用或抛弃。
-| plugin | status | version | description |
-|-----------------|--------|----------|---------------------------------------------|
-| CheckUpdate | true | 21.06.25 | 程序检查更新 |
-| Login | true | 21.06.25 | 账号登录、刷新、维持 |
-| Schedule | true | 21.06.25 | 控制插件运行周期 |
-| MainSite | true | 21.06.25 | 投币、观看、分享视频 (速升6级不是梦) |
-| DailyBag | true | 21.06.25 | 双端领取日常/周常礼包 |
-| ManGa | true | 21.06.25 | 漫画签到、分享 |
-| ActivityLottery | true | 21.06.25 | 主站活动九宫格抽奖 |
-| Competition | true | 21.06.25 | 游戏赛事竞猜 |
-| DoubleHeart | true | 21.06.25 | 双端心跳 (姥爷直播经验) |
-| DailyTask | true | 21.06.25 | 直播每日任务(签到、观看) |
-| Barrage | true | 21.06.25 | 保持活跃弹幕 |
-| Silver2Coin | true | 21.06.25 | 银瓜子兑换硬币 |
-| Judge | true | 21.06.25 | 风纪委员投票 |
-| GiftSend | true | 21.06.25 | 礼物赠送、维持每日勋章亲密度 |
-| GroupSignIn | true | 21.06.25 | 友爱社签到 |
-| GiftHeart | true | 21.06.25 | 日常心跳每日礼包礼物 |
-| SmallHeart | true | 21.06.25 | 直播挂机,每日24个小心心 |
-| MaterialObject | true | 21.06.25 | 直播金色宝箱实物抽奖 |
-| AloneTcpClient | true | 21.06.25 | 作者的独立直播监控(可支持本项目哦) |
-| ZoneTcpClient | true | 21.06.25 | 官方的分区直播监控 |
-| StormRaffle | true | 21.06.25 | 直播节奏风暴抽奖、亿元 |
-| GiftRaffle | true | 21.06.25 | 直播礼物抽奖 |
-| PkRaffle | true | 21.06.25 | 直播大乱斗抽奖 |
-| GuardRaffle | true | 21.06.25 | 直播大航海抽奖 |
-| AnchorRaffle | true | 21.06.25 | 直播天选时刻抽奖 |
-| GiftRaffle | true | 21.06.25 | 直播礼物抽奖 |
-| AwardRecord | true | 21.06.25 | 最新的中奖纪录通知 |
-| Forward | true | 21.06.25 | 主站动态抽奖转发 |
-| CapsuleLottery | true | 21.06.25 | 直播扭蛋活动抽奖 |
-| PolishTheMedal | true | 21.06.25 | 每日自动点亮灰色勋章 |
-| CapsuleLottery | true | 21.06.25 | 直播扭蛋活动抽奖 |
-| VipPrivilege | true | 21.06.25 | 每月领取年度大会员特权(B币券、会员购优惠券) |
-| BpConsumption | true | 21.06.25 | 每月消费使用年度大会员特权的B币券 |
-| Statistics | true | 21.06.25 | 全局抽奖结果统计 |
-| Silver | false | 21.03.27 | 直播银瓜子自动开启宝箱 |
+| plugin | status | version | cycle | description |
+|-----------------|--------|----------|--------|---------------------------------------------|
+| CheckUpdate | true | 21.07.14 | 待整理 | 程序检查更新 |
+| Login | true | 21.07.14 | 待整理 | 账号登录、刷新、维持 |
+| Schedule | true | 21.07.14 | 待整理 | 控制插件运行周期 |
+| MainSite | true | 21.07.14 | 待整理 | 投币、观看、分享视频 (速升6级不是梦) |
+| DailyBag | true | 21.07.14 | 待整理 | 双端领取日常/周常礼包 |
+| ManGa | true | 21.07.14 | 待整理 | 漫画签到、分享 |
+| ActivityLottery | true | 21.07.14 | 待整理 | 主站活动九宫格抽奖 |
+| Competition | true | 21.07.14 | 待整理 | 游戏赛事竞猜 |
+| DoubleHeart | true | 21.07.14 | 待整理 | 双端心跳 (姥爷直播经验) |
+| DailyTask | true | 21.07.14 | 待整理 | 直播每日任务(签到、观看) |
+| Barrage | true | 21.07.14 | 待整理 | 保持活跃弹幕 |
+| Silver2Coin | true | 21.07.14 | 待整理 | 银瓜子兑换硬币 |
+| Judge | true | 21.07.14 | 待整理 | 风纪委员投票 |
+| GiftSend | true | 21.07.14 | 待整理 | 礼物赠送、维持每日勋章亲密度 |
+| GroupSignIn | true | 21.07.14 | 待整理 | 友爱社签到 |
+| GiftHeart | true | 21.07.14 | 待整理 | 日常心跳每日礼包礼物 |
+| SmallHeart | true | 21.07.14 | 待整理 | 直播挂机,每日24个小心心 |
+| MaterialObject | true | 21.07.14 | 待整理 | 直播金色宝箱实物抽奖 |
+| AloneTcpClient | true | 21.07.14 | 待整理 | 作者的独立直播监控(可支持本项目哦) |
+| ZoneTcpClient | true | 21.07.14 | 待整理 | 官方的分区直播监控 |
+| StormRaffle | true | 21.07.14 | 待整理 | 直播节奏风暴抽奖、亿元 |
+| GiftRaffle | true | 21.07.14 | 待整理 | 直播礼物抽奖 |
+| PkRaffle | true | 21.07.14 | 待整理 | 直播大乱斗抽奖 |
+| GuardRaffle | true | 21.07.14 | 待整理 | 直播大航海抽奖 |
+| AnchorRaffle | true | 21.07.14 | 待整理 | 直播天选时刻抽奖 |
+| GiftRaffle | true | 21.07.14 | 待整理 | 直播礼物抽奖 |
+| AwardRecord | true | 21.07.14 | 待整理 | 最新的中奖纪录通知 |
+| Forward | true | 21.07.14 | 待整理 | 主站动态抽奖转发 |
+| CapsuleLottery | true | 21.07.14 | 待整理 | 直播扭蛋活动抽奖 |
+| PolishTheMedal | true | 21.07.14 | 待整理 | 每日自动点亮灰色勋章 |
+| CapsuleLottery | true | 21.07.14 | 待整理 | 直播扭蛋活动抽奖 |
+| VipPrivilege | true | 21.07.14 | 待整理 | 每月领取年度大会员特权(B币券、会员购优惠券) |
+| BpConsumption | true | 21.07.14 | 待整理 | 每月消费使用年度大会员特权的B币券 |
+| Statistics | true | 21.07.14 | 待整理 | 全局抽奖结果统计 |
+| Silver | false | 21.03.27 | 待整理 | 直播银瓜子自动开启宝箱 |
+
## 交流反馈
@@ -81,6 +87,8 @@ Group: [55308141](https://jq.qq.com/?_wv=1027&k=5AIDaJg) | **请不要来问如
有疑问一定要先看看文档或Issue里是否存在相同的问题,再考虑其他渠道咨询。
+[comment]: <> (:cherry_blossom: :gift: :gift_heart: :confetti_ball:)
+
* [使用文档 / DOC.md](./DOC.md)
* [更新日志 / CHANGELOG.md](./CHANGELOG.md)
* [配置文档 / WIKI.md](https://github.com/lkeme/BiliHelper-personal/wiki/%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E8%AF%A6%E8%A7%A3)
diff --git a/composer.json b/composer.json
index 05d380a..cb19581 100644
--- a/composer.json
+++ b/composer.json
@@ -19,7 +19,9 @@
"klkvsk/json-decode-stream": "^1.0",
"sven/file-config": "^3.1",
"hassankhan/config": "^2.2",
- "lkeme/inifile": "^3.4"
+ "lkeme/inifile": "^3.4",
+ "adhocore/cli": "^0.9.0",
+ "vanilla/garden-cli": "^3.1"
},
"license": "MIT",
"authors": [
@@ -35,7 +37,7 @@
"BiliHelper\\Plugin\\": "src/plugin",
"BiliHelper\\Util\\": "src/util",
"BiliHelper\\Tool\\": "src/tool",
- "BiliHelper\\Backup\\": "src/backup"
+ "BiliHelper\\Script\\": "src/script"
},
"files": [
"src/core/Helpers.php"
diff --git a/composer.lock b/composer.lock
index 62ecc11..4ea622f 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,8 +4,80 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "224c6b1ce9f6f5220d3de9434a44da42",
+ "content-hash": "0678ecd04eed6db66de4668ffffec283",
"packages": [
+ {
+ "name": "adhocore/cli",
+ "version": "0.9.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/adhocore/php-cli.git",
+ "reference": "319c7dd0092c0346d9ad03366cc13d3491b57e34"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/adhocore/php-cli/zipball/319c7dd0092c0346d9ad03366cc13d3491b57e34",
+ "reference": "319c7dd0092c0346d9ad03366cc13d3491b57e34",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "php": ">=7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^6.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Ahc\\Cli\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jitendra Adhikari",
+ "email": "jiten.adhikary@gmail.com"
+ }
+ ],
+ "description": "Command line interface library for PHP",
+ "keywords": [
+ "PHP7",
+ "argument-parser",
+ "argv-parser",
+ "cli",
+ "cli-action",
+ "cli-app",
+ "cli-color",
+ "cli-option",
+ "cli-writer",
+ "command",
+ "console",
+ "console-app",
+ "php-cli",
+ "stream-input",
+ "stream-output"
+ ],
+ "support": {
+ "issues": "https://github.com/adhocore/php-cli/issues",
+ "source": "https://github.com/adhocore/php-cli/tree/0.9.0"
+ },
+ "funding": [
+ {
+ "url": "https://paypal.me/ji10",
+ "type": "custom"
+ }
+ ],
+ "time": "2021-01-06T00:25:50+00:00"
+ },
{
"name": "amphp/amp",
"version": "v2.5.2",
@@ -609,16 +681,16 @@
},
{
"name": "klkvsk/json-decode-stream",
- "version": "v1.0.2",
+ "version": "v1.0.3",
"source": {
"type": "git",
"url": "https://github.com/klkvsk/json-decode-stream.git",
- "reference": "76cbcd9eb9f1860293b82b4f071e76826bc90c82"
+ "reference": "831b5310b42b51705a2d6ae5353bba7aaa302358"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/klkvsk/json-decode-stream/zipball/76cbcd9eb9f1860293b82b4f071e76826bc90c82",
- "reference": "76cbcd9eb9f1860293b82b4f071e76826bc90c82",
+ "url": "https://api.github.com/repos/klkvsk/json-decode-stream/zipball/831b5310b42b51705a2d6ae5353bba7aaa302358",
+ "reference": "831b5310b42b51705a2d6ae5353bba7aaa302358",
"shasum": "",
"mirrors": [
{
@@ -663,9 +735,9 @@
],
"support": {
"issues": "https://github.com/klkvsk/json-decode-stream/issues",
- "source": "https://github.com/klkvsk/json-decode-stream/tree/v1.0.2"
+ "source": "https://github.com/klkvsk/json-decode-stream/tree/v1.0.3"
},
- "time": "2021-03-23T14:26:50+00:00"
+ "time": "2021-06-29T23:00:36+00:00"
},
{
"name": "laminas/laminas-servicemanager",
@@ -762,16 +834,16 @@
},
{
"name": "laminas/laminas-stdlib",
- "version": "3.3.1",
+ "version": "3.4.0",
"source": {
"type": "git",
"url": "https://github.com/laminas/laminas-stdlib.git",
- "reference": "d81c7ffe602ed0e6ecb18691019111c0f4bf1efe"
+ "reference": "e89c2268c9cad25099f562f7f015c28c5dd383c9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/d81c7ffe602ed0e6ecb18691019111c0f4bf1efe",
- "reference": "d81c7ffe602ed0e6ecb18691019111c0f4bf1efe",
+ "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/e89c2268c9cad25099f562f7f015c28c5dd383c9",
+ "reference": "e89c2268c9cad25099f562f7f015c28c5dd383c9",
"shasum": "",
"mirrors": [
{
@@ -788,9 +860,11 @@
"zendframework/zend-stdlib": "^3.2.1"
},
"require-dev": {
- "laminas/laminas-coding-standard": "~1.0.0",
+ "laminas/laminas-coding-standard": "~2.3.0",
"phpbench/phpbench": "^0.17.1",
- "phpunit/phpunit": "~9.3.7"
+ "phpunit/phpunit": "~9.3.7",
+ "psalm/plugin-phpunit": "^0.16.0",
+ "vimeo/psalm": "^4.7"
},
"type": "library",
"autoload": {
@@ -822,7 +896,7 @@
"type": "community_bridge"
}
],
- "time": "2020-11-19T20:18:59+00:00"
+ "time": "2021-06-28T21:37:31+00:00"
},
{
"name": "laminas/laminas-text",
@@ -1715,6 +1789,67 @@
}
],
"time": "2021-05-27T09:17:38+00:00"
+ },
+ {
+ "name": "vanilla/garden-cli",
+ "version": "v3.1.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/vanilla/garden-cli.git",
+ "reference": "d9844c47f4f2812259ee1b583aa66e7b6b5d85c5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/vanilla/garden-cli/zipball/d9844c47f4f2812259ee1b583aa66e7b6b5d85c5",
+ "reference": "d9844c47f4f2812259ee1b583aa66e7b6b5d85c5",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "ext-json": "*",
+ "php": ">=7.2",
+ "psr/log": "^1.0"
+ },
+ "require-dev": {
+ "ergebnis/composer-normalize": "^2.8",
+ "phpdocumentor/reflection-docblock": "^4.3",
+ "phpunit/phpunit": "^8",
+ "vanilla/garden-container": "^3.0",
+ "vanilla/standards": "^1.3",
+ "vimeo/psalm": "^3.16"
+ },
+ "suggest": {
+ "ext-pdo": "Required for the DbUtils class.",
+ "phpdocumentor/reflection-docblock": "Required for the CliApplication functionality.",
+ "vanilla/garden-container": "Required for the CliApplication functionality."
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Garden\\Cli\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Todd Burry",
+ "email": "todd@vanillaforums.com"
+ }
+ ],
+ "description": "A full-featured, yet ridiculously simple commandline parser for your next php cli script. Stop fighting with getopt().",
+ "support": {
+ "issues": "https://github.com/vanilla/garden-cli/issues",
+ "source": "https://github.com/vanilla/garden-cli/tree/v3.1.2"
+ },
+ "time": "2020-10-25T13:36:44+00:00"
}
],
"packages-dev": [],
diff --git a/conf/user.ini.example b/conf/user.ini.example
index eb1e4dd..f5efb82 100644
--- a/conf/user.ini.example
+++ b/conf/user.ini.example
@@ -149,7 +149,7 @@ bp2gold = false
enable = false
clear_dynamic = false
clear_group_follow = false
-min_fans_num = 4999
+min_fans_num = 15000
auto_reply_text =
filter_words =
diff --git a/data/filter_library.json b/data/filter_library.json
index 9c943ec..2279335 100644
--- a/data/filter_library.json
+++ b/data/filter_library.json
@@ -640,7 +640,8 @@
"wav使用权",
"曲谱",
"抽个寂寞",
- "儿子"
+ "儿子",
+ "送我"
],
"uid_list": [
28008897,
diff --git a/data/latest_version.json b/data/latest_version.json
index d964f18..ea47efc 100644
--- a/data/latest_version.json
+++ b/data/latest_version.json
@@ -5,7 +5,7 @@
"source": "https://github.com/lkeme/BiliHelper-personal",
"raw_url": "https://cdn.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest_version.json",
"purge_url": "https://purge.jsdelivr.net/gh/lkeme/BiliHelper-personal@master/data/latest_version.json",
- "version": "0.9.6.210625",
+ "version": "0.9.7.210714",
"des": "程序有更新,请及时线上查看更新哦~",
- "time": "2021年6月25日11:40:35"
+ "time": "2021年7月14日11:40:35"
}
\ No newline at end of file
diff --git a/index.php b/index.php
index 30eb11b..dd2a4b3 100644
--- a/index.php
+++ b/index.php
@@ -11,10 +11,7 @@
require 'vendor/autoload.php';
-
-$filename = $argv[1] ?? 'user.ini';
-
$app = new BiliHelper\Core\App(__DIR__);
-$app->load($filename)
+$app->load($argv)
->inspect()
->start();
diff --git a/src/core/App.php b/src/core/App.php
index ecdce88..a235f9a 100644
--- a/src/core/App.php
+++ b/src/core/App.php
@@ -11,10 +11,14 @@
namespace BiliHelper\Core;
use Amp\Loop;
+use Ahc\Cli\IO\Interactor;
use function Amp\asyncCall;
class App
{
+ private $script_mode = false;
+ private $loop_mode = true;
+
/**
* App constructor.
* @param string $app_path
@@ -39,39 +43,58 @@ class App
/**
* @use 加载配置
- * @param string $load_file
+ * @param $argv
* @return $this
*/
- public function load(string $load_file = 'user.ini'): App
+ public function load($argv): App
{
- Config::load($load_file);
+ $args = (new Command($argv))->run();
+ $filename = $args->getArg(0) ?? 'user.ini';
+ $this->script_mode = $args->getOpt('script');
+
+ Config::load($filename);
return $this;
}
/**
* @use 新任务
* @param string $taskName
+ * @param string $dir
*/
- public function newTask(string $taskName)
+ public function newTask(string $taskName, string $dir)
{
- asyncCall(function () use ($taskName) {
+ asyncCall(function () use ($taskName, $dir) {
while (true) {
try {
- call_user_func(array('BiliHelper\Plugin\\' . $taskName, 'run'), []);
+ call_user_func(array("BiliHelper\\$dir\\" . $taskName, 'run'), []);
} catch (\Throwable $e) {
$error_msg = "MSG: {$e->getMessage()} CODE: {$e->getCode()} FILE: {$e->getFile()} LINE: {$e->getLine()}";
Log::error($error_msg);
// Notice::push('error', $error_msg);
}
- yield call_user_func(array('BiliHelper\Plugin\\' . $taskName, 'Delayed'), []);
+ yield call_user_func(array("BiliHelper\\$dir\\" . $taskName, 'Delayed'), []);
}
});
}
/**
- * @use 核心运行
+ * @use Script模式
*/
- public function start()
+ private function script_m()
+ {
+ $scripts = [
+ 'UnFollow' => '批量取消关注(暂测试)',
+ 'DelDynamic' => '批量清理动态(未完成)'
+ ];
+
+ $choice = \BiliHelper\Script\BaseTask::choice($scripts, 'UnFollow');
+ $this->newTask($choice, 'Script');
+ }
+
+ /**
+ * @use Loop模式
+ */
+ private function loop_m()
{
$plugins = [
'CheckUpdate',
@@ -110,8 +133,24 @@ class App
];
foreach ($plugins as $plugin) {
- $this->newTask($plugin);
+ $this->newTask($plugin, 'Plugin');
}
Loop::run();
}
+
+
+ /**
+ * @use 核心运行
+ */
+ public function start()
+ {
+ // Todo 模式名称需要优化
+ if ($this->script_mode) {
+ Log::info('执行Script模式');
+ $this->script_m();
+ } else {
+ Log::info('执行Loop模式');
+ $this->loop_m();
+ }
+ }
}
diff --git a/src/core/Command.php b/src/core/Command.php
new file mode 100644
index 0000000..be5a97c
--- /dev/null
+++ b/src/core/Command.php
@@ -0,0 +1,52 @@
+argv = $argv;
+ }
+
+ /**
+ * @return \Garden\Cli\Args
+ */
+ public function run(): Args
+ {
+ $cli = new Cli();
+
+ $cli->description('BHP命令行工具.')
+ ->opt('script:s', '执行的Script模式.', false, 'bool');
+
+ try {
+ $args = $cli->parse($this->argv, true);
+ } catch (\Exception $e) {
+ die('解析命令行参数错误');
+ }
+ return $args;
+ }
+
+}
+
+
+
+
diff --git a/src/core/Curl.php b/src/core/Curl.php
index 2a7e19e..d5edcb0 100644
--- a/src/core/Curl.php
+++ b/src/core/Curl.php
@@ -243,7 +243,7 @@ class Curl
'Connection' => 'keep-alive',
// 'Content-Type' => 'application/x-www-form-urlencoded',
// 'User-Agent' => 'Mozilla/5.0 BiliDroid/5.51.1 (bbcallen@gmail.com)',
- 'User-Agent' => 'Mozilla/5.0 BiliDroid/6.31.0 (bbcallen@gmail.com) os/android model/MuMu mobi_app/android build/6310200 channel/bili innerVer/6310200 osVer/7.1.2 network/2',
+ 'User-Agent' => 'Mozilla/5.0 BiliDroid/6.32.0 (bbcallen@gmail.com) os/android model/MuMu mobi_app/android build/6320200 channel/bili innerVer/6320200 osVer/7.1.2 network/2',
// 'Referer' => 'https://live.bilibili.com/',
];
$pc_headers = [
diff --git a/src/core/Helpers.php b/src/core/Helpers.php
index 886fc2b..74b12e2 100644
--- a/src/core/Helpers.php
+++ b/src/core/Helpers.php
@@ -103,4 +103,15 @@ function getUid(): int
function getCsrf(): string
{
return getConf('csrf', 'login.auth');
+}
+
+
+/**
+ * @use HttpClient
+ * @param string $url
+ * @return \HttpClient
+ */
+function newHttp(string $url): HttpClient
+{
+ return new HttpClient($url);
}
\ No newline at end of file
diff --git a/src/core/HttpClient.php b/src/core/HttpClient.php
new file mode 100644
index 0000000..ce6a0a6
--- /dev/null
+++ b/src/core/HttpClient.php
@@ -0,0 +1,159 @@
+ch = curl_init();
+ $this->url = $url;
+ curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false); //忽略 HTTPS 证书错误
+ $this->setUA("Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36");
+ }
+
+ function __destruct()
+ {
+ //防止内存泄露
+ curl_close($this->ch);
+ }
+
+ /**
+ * @use 设置UA
+ * @param string $ua
+ * @return $this
+ */
+ public function setUA(string $ua): HttpClient
+ {
+ curl_setopt($this->ch, CURLOPT_USERAGENT, $ua); //设置 UA
+ return $this;
+ }
+
+ /**
+ * @use 添加Header
+ * @param string $header
+ * @return $this
+ */
+ public function addHeader(string $header): HttpClient
+ {
+ array_push($this->headers, $header);
+ return $this;
+ }
+
+ /**
+ * @use 添加Headers
+ * @param array $headers
+ * @return $this
+ */
+ public function addHeaders(array $headers): HttpClient
+ {
+ foreach ($headers as $key => $value) {
+ array_push($this->headers, "{$key}: {$value}");
+ }
+ return $this;
+ }
+
+ /**
+ * @use 设置Cookie
+ * @param string $cookie
+ * @return $this
+ */
+ public function setCookie(string $cookie): HttpClient
+ {
+ curl_setopt($this->ch, CURLOPT_COOKIE, $cookie);
+ return $this;
+ }
+
+ /**
+ * @use 设置 url 参数
+ */
+ public function buildQuery(array $query): HttpClient
+ {
+ $this->query = http_build_query($query);
+ return $this;
+ }
+
+ /**
+ * @use 自动将 json 文本解码
+ */
+ public function asJSON(): object
+ {
+ return json_decode($this->ret);
+ }
+
+ /**
+ * @use 获取返回结果
+ */
+ public function asString(): string
+ {
+ return $this->ret;
+ }
+
+ /**
+ * @use 构造POST表单
+ * @param array $form
+ * @return $this
+ */
+ public function buildPostForm(array $form): HttpClient
+ {
+ $this->form = http_build_query($form);
+
+ return $this;
+ }
+
+ /**
+ * @use 发送 Get 请求
+ */
+ public function get(): HttpClient
+ {
+ curl_setopt($this->ch, CURLOPT_URL, $this->url . "?" . $this->query);
+ curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true); //返回内容储存到变量中
+ curl_setopt($this->ch, CURLOPT_HEADER, $this->headers);
+ $this->ret = curl_exec($this->ch);
+ return $this;
+ }
+
+ /**
+ * @use 发送 POST 请求
+ * @param string|null $data 要 POST 的数据
+ * @return \HttpClient
+ */
+ public function post(string $data = null): HttpClient
+ {
+ curl_setopt($this->ch, CURLOPT_URL, $this->url . "?" . $this->query);
+ curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true); //返回内容储存到变量中
+ curl_setopt($this->ch, CURLOPT_POST, true); // 发送 POST 请求
+ curl_setopt($this->ch, CURLOPT_HEADER, $this->headers);
+ curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data);
+ $this->ret = curl_exec($this->ch);
+ return $this;
+ }
+
+
+ /**
+ * @use POST表单
+ * @param array $form
+ * @return $this
+ */
+ public function postForm(array $form): HttpClient
+ {
+ return $this->post(http_build_query($form));
+ }
+}
+
diff --git a/src/plugin/Barrage.php b/src/plugin/Barrage.php
index f4e3e11..fb777ec 100644
--- a/src/plugin/Barrage.php
+++ b/src/plugin/Barrage.php
@@ -86,7 +86,7 @@ class Barrage
$response = Live::sendBarragePC($room_id, $content);
// {"code":0,"data":[],"message":"","msg":""}
// {"code":0,"message":"你被禁言啦","msg":"你被禁言啦"}
- // TODO 长度限制
+ // Todo 长度限制
if (isset($response['code']) && $response['code'] == 0 && isset($response['data'])) {
Log::notice("在直播间@{$room_id} 发送活跃弹幕成功 CODE -> {$response['code']}");
return true;
diff --git a/src/plugin/CapsuleLottery.php b/src/plugin/CapsuleLottery.php
index 1e83513..fe65cb4 100644
--- a/src/plugin/CapsuleLottery.php
+++ b/src/plugin/CapsuleLottery.php
@@ -108,7 +108,7 @@ class CapsuleLottery
Log::info("执行 {$task['act']->title} #{$task['operation']} 任务");
// 执行任务
switch ($task['operation']) {
- // TODO 观看 分享 签到任务
+ // Todo 观看 分享 签到任务
case 'watch':
$interval = self::xliveHeartBeatTask($task['act']->room_id, 999, 999);
self::$interval = $interval == 0 ? 60 : $interval;
diff --git a/src/plugin/CheckUpdate.php b/src/plugin/CheckUpdate.php
index 3e684e8..53d40da 100644
--- a/src/plugin/CheckUpdate.php
+++ b/src/plugin/CheckUpdate.php
@@ -47,7 +47,7 @@ class CheckUpdate
Log::info('项目已是最新版本');
} else {
Log::notice('项目有更新');
- // TODO 完善提示信息
+ // Todo 完善提示信息
$time = self::$latest_conf->get('time');
$version = self::$latest_conf->get('version');
$des = self::$latest_conf->get('des');
diff --git a/src/plugin/DataTreating.php b/src/plugin/DataTreating.php
index 1faef3b..20732e1 100644
--- a/src/plugin/DataTreating.php
+++ b/src/plugin/DataTreating.php
@@ -12,7 +12,7 @@ namespace BiliHelper\Plugin;
class DataTreating
{
- // TODO 独立分发 Push||Pull数据
+ // Todo 独立分发 Push||Pull数据
/**
* @use 抽奖分发
* @param array $data
diff --git a/src/plugin/Dynamic.php b/src/plugin/Dynamic.php
index 114dea5..fefa5e5 100644
--- a/src/plugin/Dynamic.php
+++ b/src/plugin/Dynamic.php
@@ -16,7 +16,7 @@ class Dynamic
{
use FilterWords;
- // TODO 活动订阅
+ // Todo 活动订阅
// https://www.bilibili.com/blackboard/activity-WeqT10t1ep.html
// https://api.vc.bilibili.com/topic_svr/v1/topic_svr/fetch_dynamics?topic_name=%E4%BA%92%E5%8A%A8%E6%8A%BD%E5%A5%96&sortby=2
private static $tags = ['互动抽奖', '抽奖', '转发抽奖', '动态抽奖', '关注+转发'];
@@ -52,7 +52,7 @@ class Dynamic
$description = $card['item']['description'];
} elseif (array_key_exists("content", $card['item'])) {
// 子动态
- // TODO 暂时跳过 需要合适的处理方法
+ // Todo 暂时跳过 需要合适的处理方法
// description = $card['item']['content'];
continue;
} else {
diff --git a/src/plugin/GroupSignIn.php b/src/plugin/GroupSignIn.php
index 91f9408..65d809a 100644
--- a/src/plugin/GroupSignIn.php
+++ b/src/plugin/GroupSignIn.php
@@ -71,7 +71,7 @@ class GroupSignIn
$de_raw = json_decode($raw, true);
if ($de_raw['code'] != '0') {
- // TODO 任务失败原因
+ // Todo 任务失败原因
// {"code": 710001, "msg": "应援失败>_<", "message": "应援失败>_<", "ttl": "1", "data": {"add_num": 0, "status": 0}}
if ($de_raw['code'] == '710001') {
Log::warning('在应援团{' . $groupInfo['group_name'] . '}中签到失败, 亲密度已达上限');
diff --git a/src/plugin/Judge.php b/src/plugin/Judge.php
index babafda..f6c8a9e 100644
--- a/src/plugin/Judge.php
+++ b/src/plugin/Judge.php
@@ -43,7 +43,7 @@ class Judge
}
/**
- * @use 判案 TODO: 处理案例已满(MAX20例)
+ * @use 判案 Todo: 处理案例已满(MAX20例)
* @param $case_id
* @return bool
*/
diff --git a/src/plugin/Login.php b/src/plugin/Login.php
index 7f52d03..53c9b51 100644
--- a/src/plugin/Login.php
+++ b/src/plugin/Login.php
@@ -29,7 +29,7 @@ class Login
return;
}
Log::info('启动登录程序');
- if (getConf('access_token', 'login.auth') == '') {
+ if (getAccessToken() == '') {
Log::info('准备载入登录令牌');
self::login();
}
@@ -117,7 +117,7 @@ class Login
{
$url = 'https://passport.bilibili.com/api/v2/oauth2/info';
$payload = [
- 'access_token' => getConf('access_token', 'login.auth'),
+ 'access_token' => getAccessToken(),
];
$data = Curl::get('app', $url, Sign::common($payload));
// {"ts":1234,"code":0,"data":{"mid":1234,"access_token":"1234","expires_in":7759292}}
@@ -137,8 +137,8 @@ class Login
{
$url = 'https://passport.bilibili.com/api/v2/oauth2/refresh_token';
$payload = [
- 'access_token' => getConf('access_token', 'login.auth'),
- 'refresh_token' => getConf('refresh_token', 'login.auth'),
+ 'access_token' => getAccessToken(),
+ 'refresh_token' => getRefreshToken(),
];
$raw = Curl::post('app', $url, Sign::common($payload));
$de_raw = json_decode($raw, true);
@@ -313,7 +313,7 @@ class Login
$payload = [
'cid' => getConf('country_code', 'login.country') ,
'tel' => $phone,
- 'statistics' => '{"appId":1,"platform":3,"version":"6.31.0","abtest":""}',
+ 'statistics' => '{"appId":1,"platform":3,"version":"6.32.0","abtest":""}',
];
$raw = Curl::post('app', $url, Sign::login($payload));
$de_raw = json_decode($raw, true);
diff --git a/src/plugin/ManGa.php b/src/plugin/ManGa.php
index da9f784..1592f30 100644
--- a/src/plugin/ManGa.php
+++ b/src/plugin/ManGa.php
@@ -40,7 +40,7 @@ class ManGa
sleep(1);
$url = 'https://manga.bilibili.com/twirp/activity.v1.Activity/ClockIn';
$payload = [
- 'access_key' => getConf('access_token', 'login.auth'),
+ 'access_key' => getAccessToken(),
'ts' => time()
];
$raw = Curl::post('app', $url, Sign::common($payload));
diff --git a/src/plugin/MaterialObject.php b/src/plugin/MaterialObject.php
index 2307fdc..ec6b753 100644
--- a/src/plugin/MaterialObject.php
+++ b/src/plugin/MaterialObject.php
@@ -194,7 +194,7 @@ class MaterialObject
*/
private static function calcAid($min, $max): bool
{
- // TODO 优化计算AID算法
+ // Todo 优化计算AID算法
if (self::$end_aid != 0 && self::$start_aid != 0) {
return false;
}
diff --git a/src/plugin/Schedule.php b/src/plugin/Schedule.php
index 3f154b4..3a2cbad 100644
--- a/src/plugin/Schedule.php
+++ b/src/plugin/Schedule.php
@@ -17,7 +17,7 @@ class Schedule
{
use TimeLock;
- // TODO 黑白名单|考虑添加到每个插件内部自动添加|优化RUN逻辑代码
+ // Todo 黑白名单|考虑添加到每个插件内部自动添加|优化RUN逻辑代码
private static $unlock_hour = 24;
private static $unlock_timers = [];
private static $sleep_section = [];
diff --git a/src/plugin/Sign.php b/src/plugin/Sign.php
index 45be081..5c92e79 100644
--- a/src/plugin/Sign.php
+++ b/src/plugin/Sign.php
@@ -27,7 +27,7 @@ class Sign
// $appsecret = '59b43e04ad6965f34319062b478f83dd';
//
// $default = [
-// 'access_key' => getConf('access_token', 'login.auth')
+// 'access_key' => getAccessToken()
// 'actionKey' => 'appkey',
// 'appkey' => $appkey,
// 'build' => 101800,
@@ -52,10 +52,10 @@ class Sign
$appsecret = '60698ba2f68e01ce44738920a0ffe768';
$default = [
- 'access_key' => getConf('access_token', 'login.auth'),
+ 'access_key' => getAccessToken(),
'actionKey' => 'appkey',
'appkey' => $appkey,
- 'build' => 6310200,
+ 'build' => 6320200,
'channel' => 'bili',
'device' => 'phone',
'mobi_app' => 'android',
@@ -81,10 +81,10 @@ class Sign
$appsecret = '560c52ccd288fed045859ed18bffd973';
$default = [
- 'access_key' => getConf('access_token', 'login.auth'),
+ 'access_key' => getAccessToken(),
'actionKey' => 'appkey',
'appkey' => $appkey,
- 'build' => 6310200,
+ 'build' => 6320200,
'device' => 'phone',
'mobi_app' => 'android',
'platform' => 'android',
diff --git a/src/plugin/Statistics.php b/src/plugin/Statistics.php
index 52a8868..3701bfa 100644
--- a/src/plugin/Statistics.php
+++ b/src/plugin/Statistics.php
@@ -23,7 +23,7 @@ class Statistics
private static $success_list = [];
private static $profit_list = [];
- // TODO 统计开关 统计时间间隔 统计类型
+ // Todo 统计开关 统计时间间隔 统计类型
public static function run()
{
if (self::getLock() > time()) {
diff --git a/src/plugin/ZoneTcpClient.php b/src/plugin/ZoneTcpClient.php
index c9b167b..555c998 100644
--- a/src/plugin/ZoneTcpClient.php
+++ b/src/plugin/ZoneTcpClient.php
@@ -499,7 +499,7 @@ class ZoneTcpClient
break;
Log::debug("Socket debug: select timeout" . PHP_EOL);
}
- // TODO unable to read from socket[104]: Connection reset by peer
+ // Todo unable to read from socket[104]: Connection reset by peer
$ret = socket_recv($socket, $buffer, $length, 0);
if ($ret < 1) {
Log::warning("Socket error: [{$ret}] [{$length}]" . PHP_EOL);
diff --git a/src/script/BaseTask.php b/src/script/BaseTask.php
new file mode 100644
index 0000000..407c479
--- /dev/null
+++ b/src/script/BaseTask.php
@@ -0,0 +1,63 @@
+choice('Select', $options, $default, true);
+ static::interactor()->greenBold("You selected: {$options[$option]}", true);
+ // return $options[$option];
+ return $option;
+ }
+
+ /**
+ * @use 确认
+ * @param string $msg
+ * @param string $default
+ * @return bool
+ */
+ public static function confirm(string $msg, string $default = 'n'): bool
+ {
+ $confirm = static::interactor()->confirm($msg, $default); // Default: n (no)
+ if (!$confirm) die();
+// if ($confirm) { // is a boolean
+// static::interactor()->greenBold('是 :)', true); // Output green bold text
+// } else {
+// static::interactor()->redBold('否 :(', true); // Output red bold text
+// die();
+// }
+ return true;
+ }
+
+ /**
+ * @return \Ahc\Cli\IO\Interactor
+ */
+ public static function interactor(): Interactor
+ {
+ return static::$interactor ?? static::$interactor = new Interactor;
+ }
+}
\ No newline at end of file
diff --git a/src/script/DelDynamic.php b/src/script/DelDynamic.php
new file mode 100644
index 0000000..b12c5d7
--- /dev/null
+++ b/src/script/DelDynamic.php
@@ -0,0 +1,22 @@
+ $up_uname) {
+ $payload = [
+ 'fid' => $up_uid,
+ 'act' => 2,
+ 're_src' => 11,
+ 'csrf' => getCsrf(),
+ ];
+ $headers = [
+ 'origin' => 'https://space.bilibili.com',
+ 'referer' => 'https://space.bilibili.com/' . getUid() . '/fans/follow?tagid=' . $tag_id,
+ ];
+ $raw = Curl::post('pc', $url, $payload, $headers);
+ // {"code":0,"message":"0","ttl":1}
+ $data = json_decode($raw, true);
+ if ($data['code'] == 0) {
+ Log::notice("UP.{$up_uid} - {$up_uname} 取关成功");
+ } else {
+ Log::error("UP.{$up_uid} - {$up_uname} 取关失败 CODE -> {$data['code']} MSG -> {$data['message']} ");
+ break;
+ }
+ sleep(random_int(5, 10));
+ }
+ }
+
+
+ /**
+ * @use 获取分组关注
+ * @param $tag_id
+ * @param int $max_pn
+ * @param int $max_ps
+ * @return array
+ * @throws \Exception
+ */
+ private static function relationTag($tag_id, int $max_pn = 30, int $max_ps = 20): array
+ {
+ $following = [];
+ $url = 'https://api.bilibili.com/x/relation/tag';
+ for ($pn = 1; $pn <= $max_pn; $pn++) {
+ $payload = [
+ 'mid' => getUid(),
+ 'tagid' => $tag_id,
+ 'pn' => $pn,
+ 'ps' => $max_ps,
+ ];
+ $headers = [
+ 'referer' => 'https://space.bilibili.com/' . getUid() . '/fans/follow',
+ ];
+ $raw = Curl::get('pc', $url, $payload, $headers);
+ $data = json_decode($raw, true);
+ if ($data['code'] == 0 && isset($data['data'])) {
+ // 循环添加到 following
+ foreach ($data['data'] as $up) {
+ $following[$up['mid']] = $up['uname'];
+ }
+ // 打印和延迟
+ Log::info("已获取分组 {$tag_id} 页码 {$pn}");
+ sleep(random_int(4, 8));
+ // 如果页面不等于 max_ps 跳出
+ if (count($data['data']) != $max_ps) {
+ break;
+ }
+ } else {
+ Log::error("获取分组关注失败 CODE -> {$data['code']} MSG -> {$data['message']} ");
+ break;
+ }
+ }
+ $following_num = count($following);
+ Log::notice("已获取分组 {$tag_id} 有效关注数 {$following_num}");
+ return $following;
+ }
+
+
+ /**
+ * @use 获取分组
+ * @return mixed
+ */
+ private static function relationTags()
+ {
+ $url = 'https://api.bilibili.com/x/relation/tags';
+ $payload = [];
+ $headers = [
+ 'referer' => 'https://space.bilibili.com/',
+ ];
+ $raw = Curl::get('pc', $url, $payload, $headers);
+ $data = json_decode($raw, true);
+ if ($data['code'] == 0 && isset($data['data'])) {
+ $options = [];
+ foreach ($data['data'] as $tag) {
+ $options[$tag['tagid']] = "分组:{$tag['name']} - 关注数:{$tag['count']}";
+ }
+ $option = self::choice($options);
+ Log::notice("已获取分组 {$option} - {$options[$option]}");
+ return $option;
+ } else {
+ Log::error("获取关注分组失败 CODE -> {$data['code']} MSG -> {$data['message']} ");
+ die();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/script/User.php b/src/script/User.php
new file mode 100644
index 0000000..4036c42
--- /dev/null
+++ b/src/script/User.php
@@ -0,0 +1,57 @@
+ {$data['code']} MSG -> {$data['message']} ");
+ die();
+ }
+ return true;
+ }
+
+ /**
+ * @use 用户
+ * @return mixed
+ */
+ public static function userInfo()
+ {
+ $url = 'https://api.bilibili.com/x/web-interface/nav';
+ $payload = [];
+ $headers = [
+ 'origin' => 'https://space.bilibili.com',
+ 'referer' => 'https://space.bilibili.com/' . getUid(),
+ ];
+ $raw = Curl::get('pc', $url, $payload, $headers);
+ return json_decode($raw, true);
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/tool/UserAgent.php b/src/tool/UserAgent.php
new file mode 100644
index 0000000..30f011f
--- /dev/null
+++ b/src/tool/UserAgent.php
@@ -0,0 +1,401 @@
+ [
+ 'GT-I9:number2-5:00 Build/JDQ39',
+ 'Nokia 3:number1-3:[10|15] Build/IMM76D',
+ '[SAMSUNG |]SM-G3:number1-5:0[R5|I|V|A|T|S] Build/JLS36C',
+ 'Ascend G3:number0-3:0 Build/JLS36I',
+ '[SAMSUNG |]SM-G3:number3-6::number1-8::number0-9:[V|A|T|S|I|R5] Build/JLS36C',
+ 'HUAWEI G6-L:number10-11: Build/HuaweiG6-L:number10-11:',
+ '[SAMSUNG |]SM-[G|N]:number7-9:1:number0-8:[S|A|V|T] Build/[JLS36C|JSS15J]',
+ '[SAMSUNG |]SGH-N0:number6-9:5[T|V|A|S] Build/JSS15J',
+ 'Samsung Galaxy S[4|IV] Mega GT-I:number89-95:00 Build/JDQ39',
+ 'SAMSUNG SM-T:number24-28:5[s|a|t|v] Build/[JLS36C|JSS15J]',
+ 'HP :number63-73:5 Notebook PC Build/[JLS36C|JSS15J]',
+ 'HP Compaq 2:number1-3:10b Build/[JLS36C|JSS15J]',
+ 'HTC One 801[s|e] Build/[JLS36C|JSS15J]',
+ 'HTC One max Build/[JLS36C|JSS15J]',
+ 'HTC Xplorer A:number28-34:0[e|s] Build/GRJ90'
+ ],
+ '4.4' => [
+ 'XT10:number5-8:0 Build/SU6-7.3',
+ 'XT10:number12-52: Build/[KXB20.9|KXC21.5]',
+ 'Nokia :number30-34:10 Build/IMM76D',
+ 'E:number:20-23::number0-3::number0-4: Build/24.0.[A|B].1.34',
+ '[SAMSUNG |]SM-E500[F|L] Build/KTU84P',
+ 'LG Optimus G Build/KRT16M',
+ 'LG-E98:number7-9: Build/KOT49I',
+ 'Elephone P:number2-6:000 Build/KTU84P',
+ 'IQ450:number0-4: Quad Build/KOT49H',
+ 'LG-F:number2-5:00[K|S|L] Build/KOT49[I|H]',
+ 'LG-V:number3-7::number0-1:0 Build/KOT49I',
+ '[SAMSUNG |]SM-J:number1-2::number0-1:0[G|F] Build/KTU84P',
+ '[SAMSUNG |]SM-N80:number0-1:0 Build/[KVT49L|JZO54K]',
+ '[SAMSUNG |]SM-N900:number5-8: Build/KOT49H',
+ '[SAMSUNG-|]SGH-I337[|M] Build/[JSS15J|KOT49H]',
+ '[SAMSUNG |]SM-G900[W8|9D|FD|H|V|FG|A|T] Build/KOT49H',
+ '[SAMSUNG |]SM-T5:number30-35: Build/[KOT49H|KTU84P]',
+ '[Google |]Nexus :number5-7: Build/KOT49H',
+ 'LG-H2:number0-2:0 Build/KOT49[I|H]',
+ 'HTC One[_M8|_M9|0P6B|801e|809d|0P8B2|mini 2|S][ dual sim|] Build/[KOT49H|KTU84L]',
+ '[SAMSUNG |]GT-I9:number3-5:0:number0-6:[V|I|T|N] Build/KOT49H',
+ 'Lenovo P7:number7-8::number1-6: Build/[Lenovo|JRO03C]',
+ 'LG-D95:number1-8: Build/KOT49[I|H]',
+ 'LG-D:number1-8::number0-8:0 Build/KOT49[I|H]',
+ 'Nexus5 V:number6-7:.1 Build/KOT49H',
+ 'Nexus[_|] :number4-10: Build/[KOT49H|KTU84P]',
+ 'Nexus[_S_| S ][4G |]Build/GRJ22',
+ '[HM NOTE|NOTE-III|NOTE2 1LTE[TD|W|T]',
+ 'ALCATEL ONE[| ]TOUCH 70:number2-4::number0-9:[X|D|E|A] Build/KOT49H',
+ 'MOTOROLA [MOTOG|MSM8960|RAZR] Build/KVT49L'
+ ],
+ '5.0' => [
+ 'Nokia :number10-11:00 [wifi|4G|LTE] Build/GRK39F',
+ 'HTC 80:number1-2[s|w|e|t] Build/[LRX22G|JSS15J]',
+ 'Lenovo A7000-a Build/LRX21M;',
+ 'HTC Butterfly S [901|919][s|d|] Build/LRX22G',
+ 'HTC [M8|M9|M8 Pro Build/LRX22G',
+ 'LG-D3:number25-37: Build/LRX22G',
+ 'LG-D72:number0-9: Build/LRX22G',
+ '[SAMSUNG |]SM-G4:number0-9:0 Build/LRX22[G|C]',
+ '[|SAMSUNG ]SM-G9[00|25|20][FD|8|F|F-ORANGE|FG|FQ|H|I|L|M|S|T] Build/[LRX21T|KTU84F|KOT49H]',
+ '[SAMSUNG |]SM-A:number7-8:00[F|I|T|H|] Build/[LRX22G|LMY47X]',
+ '[SAMSUNG-|]SM-N91[0|5][A|V|F|G|FY] Build/LRX22C',
+ '[SAMSUNG |]SM-[T|P][350|550|555|355|805|800|710|810|815] Build/LRX22G',
+ 'LG-D7:number0-2::number0-9: Build/LRX22G',
+ '[LG|SM]-[D|G]:number8-9::number0-5::number0-9:[|P|K|T|I|F|T1] Build/[LRX22G|KOT49I|KVT49L|LMY47X]'
+ ],
+ '5.1' => [
+ 'Nexus :number5-9: Build/[LMY48B|LRX22C]',
+ '[|SAMSUNG ]SM-G9[28|25|20][X|FD|8|F|F-ORANGE|FG|FQ|H|I|L|M|S|T] Build/[LRX22G|LMY47X]',
+ '[|SAMSUNG ]SM-G9[35|350][X|FD|8|F|F-ORANGE|FG|FQ|H|I|L|M|S|T] Build/[MMB29M|LMY47X]',
+ '[MOTOROLA |][MOTO G|MOTO G XT1068|XT1021|MOTO E XT1021|MOTO XT1580|MOTO X FORCE XT1580|MOTO X PLAY XT1562|MOTO XT1562|MOTO XT1575|MOTO X PURE XT1575|MOTO XT1570 MOTO X STYLE] Build/[LXB22|LMY47Z|LPC23|LPK23|LPD23|LPH223]'
+ ],
+ '6.0' => [
+ '[SAMSUNG |]SM-[G|D][920|925|928|9350][V|F|I|L|M|S|8|I] Build/[MMB29K|MMB29V|MDB08I|MDB08L]',
+ 'Nexus :number5-7:[P|X|] Build/[MMB29K|MMB29V|MDB08I|MDB08L]',
+ 'HTC One[_| ][M9|M8|M8 Pro] Build/MRA58K',
+ 'HTC One[_M8|_M9|0P6B|801e|809d|0P8B2|mini 2|S][ dual sim|] Build/MRA58K'
+ ],
+ '7.0' => [
+ 'Pixel [XL|C] Build/[NRD90M|NME91E]',
+ 'Nexus :number5-9:[X|P|] Build/[NPD90G|NME91E]',
+ '[SAMSUNG |]GT-I:number91-98:00 Build/KTU84P',
+ 'Xperia [V |]Build/NDE63X',
+ 'LG-H:number90-93:0 Build/NRD90[C|M]'
+ ],
+ '7.1' => [
+ 'Pixel [XL|C] Build/[NRD90M|NME91E]',
+ 'Nexus :number5-9:[X|P|] Build/[NPD90G|NME91E]',
+ '[SAMSUNG |]GT-I:number91-98:00 Build/KTU84P',
+ 'Xperia [V |]Build/NDE63X',
+ 'LG-H:number90-93:0 Build/NRD90[C|M]'
+ ]
+ ];
+ public $locale = 'en-US';
+ /**
+ * List of "OS" strings used for android
+ * @var array $android_os
+ */
+ public $android_os = [
+ 'Linux; Android :androidVersion:; :androidDevice:',
+ //Todo: Add a $windowsDevices variable that does the same as androidDevice
+ //'Windows Phone 10.0; Android :androidVersion:; :windowsDevice:',
+ 'Linux; U; Android :androidVersion:; :androidDevice:',
+ 'Android; Android :androidVersion:; :androidDevice:'
+ ];
+ /**
+ * List of "OS" strings used for iOS
+ * @var array $mobile_ios
+ */
+ public $mobile_ios = [
+ 'iphone' => 'iPhone; CPU iPhone OS :number7-11:_:number0-9:_:number0-9:; like Mac OS X;',
+ 'ipad' => 'iPad; CPU iPad OS :number7-11:_:number0-9:_:number0-9: like Mac OS X;',
+ 'ipod' => 'iPod; CPU iPod OS :number7-11:_:number0-9:_:number0-9:; like Mac OS X;'
+ ];
+
+ /**
+ * Get a random operating system
+ * @param string|null $os
+ * @return string *
+ */
+ public function getOS(string $os = NULL)
+ {
+ $_os = [];
+ if ($os === NULL || in_array($os, ['chrome', 'firefox', 'explorer'])) {
+ $_os = $os === 'explorer' ? $this->windows_os : array_merge($this->windows_os, $this->linux_os, $this->mac_os);
+ } else {
+ $_os += $this->{$os . '_os'};
+ }
+ // randomly select on operating system
+ $selected_os = rtrim($_os[random_int(0, count($_os) - 1)], ';');
+
+ // check for spin syntax
+ if (strpos($selected_os, '[') !== FALSE) {
+ $selected_os = self::processSpinSyntax($selected_os);
+ }
+
+ // check for random number syntax
+ if (strpos($selected_os, ':number') !== FALSE) {
+ $selected_os = self::processRandomNumbers($selected_os);
+ }
+
+ if (random_int(1, 100) > 50) {
+ $selected_os .= '; ' . $this->locale;
+ }
+ return $selected_os;
+ }
+
+ /**
+ * Get Mobile OS
+ * @param string|null $os Can specifiy android, iphone, ipad, ipod, or null/blank for random
+ * @return string *
+ */
+ public function getMobileOS(string $os = NULL)
+ {
+ $os = strtolower($os);
+ $_os = [];
+ switch ($os) {
+ case'android':
+ $_os += $this->android_os;
+ break;
+ case 'iphone':
+ case 'ipad':
+ case 'ipod':
+ $_os[] = $this->mobile_ios[$os];
+ break;
+ default:
+ $_os = array_merge($this->android_os, array_values($this->mobile_ios));
+ }
+ // select random mobile os
+ $selected_os = rtrim($_os[random_int(0, count($_os) - 1)], ';');
+ if (strpos($selected_os, ':androidVersion:') !== FALSE) {
+ $selected_os = $this->processAndroidVersion($selected_os);
+ }
+ if (strpos($selected_os, ':androidDevice:') !== FALSE) {
+ $selected_os = $this->addAndroidDevice($selected_os);
+ }
+ if (strpos($selected_os, ':number') !== FALSE) {
+ $selected_os = self::processRandomNumbers($selected_os);
+ }
+ return $selected_os;
+ }
+
+ /**
+ * static::processRandomNumbers
+ * @param $selected_os
+ * @return null|string|string[] *
+ */
+ public static function processRandomNumbers($selected_os)
+ {
+ return preg_replace_callback('/:number(\d+)-(\d+):/i', function ($matches) {
+ return random_int($matches[1], $matches[2]);
+ }, $selected_os);
+ }
+
+ /**
+ * static::processSpinSyntax
+ * @param $selected_os
+ * @return null|string|string[] *
+ */
+ public static function processSpinSyntax($selected_os)
+ {
+ return preg_replace_callback('/\[([\w\-\s|;]*?)\]/i', function ($matches) {
+ $shuffle = explode('|', $matches[1]);
+ return $shuffle[array_rand($shuffle)];
+ }, $selected_os);
+ }
+
+ /**
+ * processAndroidVersion
+ * @param $selected_os
+ * @return null|string|string[] *
+ */
+ public function processAndroidVersion($selected_os)
+ {
+ $this->androidVersion = $version = $this->androidVersions[array_rand($this->androidVersions)];
+ return preg_replace_callback('/:androidVersion:/i', function ($matches) use ($version) {
+ return $version;
+ }, $selected_os);
+ }
+
+ /**
+ * addAndroidDevice
+ * @param $selected_os
+ * @return null|string|string[] *
+ */
+ public function addAndroidDevice($selected_os)
+ {
+ $devices = $this->androidDevices[substr($this->androidVersion, 0, 3)];
+ $device = $devices[array_rand($devices)];
+
+ $device = self::processSpinSyntax($device);
+ return preg_replace_callback('/:androidDevice:/i', function ($matches) use ($device) {
+ return $device;
+ }, $selected_os);
+ }
+
+ /**
+ * static::chromeVersion
+ * @param $version
+ * @return string *
+ */
+ public static function chromeVersion($version): string
+ {
+ return random_int($version['min'], $version['max']) . '.0.' . random_int(1000, 4000)
+ . '.' . random_int(100, 400);
+ }
+
+ /**
+ * static::firefoxVersion
+ * @param $version
+ * @return string *
+ */
+ public static function firefoxVersion($version): string
+ {
+ return random_int($version['min'], $version['max']) . '.' . random_int(0, 9);
+ }
+
+ /**
+ * static::windows
+ * @param $version
+ * @return string *
+ */
+ public static function windows($version): string
+ {
+ return random_int($version['min'], $version['max']) . '.' . random_int(0, 9);
+ }
+
+ /**
+ * generate
+ * @param null $userAgent
+ * @return string *
+ */
+ public function generate($userAgent = NULL, $locale = null): string
+ {
+
+ if (!is_null($locale))
+ $this->locale = $locale;
+
+ if ($userAgent === NULL) {
+ $r = random_int(0, 100);
+ if ($r >= 44) {
+ $userAgent = array_rand(['firefox' => 1, 'chrome' => 1, 'explorer' => 1]);
+ } else {
+ $userAgent = array_rand(['iphone' => 1, 'android' => 1, 'mobile' => 1]);
+ }
+ } elseif ($userAgent == 'windows' || $userAgent == 'mac' || $userAgent == 'linux') {
+ $agents = ['firefox' => 1, 'chrome' => 1];
+ if ($userAgent == 'windows') {
+ $agents['explorer'] = 1;
+ }
+ $userAgent = array_rand($agents);
+ }
+ $_SESSION['agent'] = $userAgent;
+ if ($userAgent == 'chrome') {
+ return 'Mozilla/5.0 (' . $this->getOS($userAgent) . ') AppleWebKit/' .
+ (random_int(1, 100) > 50 ? random_int(533, 537) : random_int(600, 603))
+ . '.' . random_int(1, 50) . ' (KHTML, like Gecko) Chrome/' .
+ self::chromeVersion(['min' => 47, 'max' => 55]) . ' Safari/'
+ . (random_int(1, 100) > 50 ? random_int(533, 537) : random_int(600, 603));
+ } elseif ($userAgent == 'firefox') {
+
+ return 'Mozilla/5.0 (' . $this->getOS($userAgent) . ') Gecko/'
+ . (random_int(1, 100) > 30 ? '20100101' : '20130401') . ' Firefox/'
+ . self::firefoxVersion(['min' => 45, 'max' => 74]);
+ } elseif ($userAgent == 'explorer') {
+
+ return 'Mozilla / 5.0 (compatible; MSIE ' . ($int = random_int(7, 11))
+ . '.0; ' . $this->getOS('windows') . ' Trident / '
+ . ($int == 7 || $int == 8 ? '4' : ($int == 9 ? '5' : ($int == 10 ? '6' : '7')))
+ . '.0)';
+ } elseif ($userAgent == 'mobile'
+ || $userAgent == 'android'
+ || $userAgent == 'iphone'
+ || $userAgent == 'ipad'
+ || $userAgent == 'ipod') {
+
+ return 'Mozilla/5.0 (' . $this->getMobileOS($userAgent) . ') AppleWebKit/'
+ . (random_int(1, 100) > 50 ? random_int(533, 537) : random_int(600, 603))
+ . '.' . random_int(1, 50) . ' (KHTML, like Gecko) Chrome/'
+ . self::chromeVersion(['min' => 47, 'max' => 55]) . ' Mobile Safari/'
+ . (random_int(1, 100) > 50 ? random_int(533, 537) : random_int(600, 603))
+ . '.' . random_int(0, 9);
+ } else {
+ new Exception('Unable to determine user agent to generate');
+ }
+ }
+}
diff --git a/src/util/BaseRaffle.php b/src/util/BaseRaffle.php
index d12eb6e..1c80ddb 100644
--- a/src/util/BaseRaffle.php
+++ b/src/util/BaseRaffle.php
@@ -97,7 +97,7 @@ abstract class BaseRaffle
$raw = Curl::get('app', $url, Sign::common($payload));
$de_raw = json_decode($raw, true);
if (!isset($de_raw['data']) || $de_raw['code']) {
- // TODO 请求被拦截 412
+ // Todo 请求被拦截 412
Log::error("获取抽奖数据错误,{$de_raw['message']}");
return [];
}
@@ -133,7 +133,7 @@ abstract class BaseRaffle
* @param string $type
* @return array
*/
- protected static function arrKeySort($arr, $key, $type = 'asc'): array
+ protected static function arrKeySort($arr, $key, string $type = 'asc'): array
{
switch ($type) {
case 'desc':
@@ -153,7 +153,7 @@ abstract class BaseRaffle
* @param bool $filter
* @return bool
*/
- protected static function toRepeatLid($lid, $filter = true): bool
+ protected static function toRepeatLid($lid, bool $filter = true): bool
{
$lid = (int)$lid;
if (in_array($lid, static::$all_list)) {
From 5f12fc6e5bd3e882a3402cad69b6b06392355ab1 Mon Sep 17 00:00:00 2001
From: Lkeme <19500576+lkeme@users.noreply.github.com>
Date: Wed, 14 Jul 2021 11:32:26 +0800
Subject: [PATCH 28/28] [update] Script Mode
---
CHANGELOG.md | 1 +
src/core/App.php | 1 -
src/script/UnFollow.php | 2 +-
3 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index aff8c0f..4a6ad3a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,6 +28,7 @@
### Remarks
- 注意配置文件有些许改动
+- 注意需要重新进行`composer update`操作
-
## v0.9.6.210625 alpha (2021-06-25)
diff --git a/src/core/App.php b/src/core/App.php
index a235f9a..749bf3e 100644
--- a/src/core/App.php
+++ b/src/core/App.php
@@ -11,7 +11,6 @@
namespace BiliHelper\Core;
use Amp\Loop;
-use Ahc\Cli\IO\Interactor;
use function Amp\asyncCall;
class App
diff --git a/src/script/UnFollow.php b/src/script/UnFollow.php
index b73a5af..51c3ec0 100644
--- a/src/script/UnFollow.php
+++ b/src/script/UnFollow.php
@@ -14,7 +14,7 @@ use BiliHelper\Core\Curl;
class UnFollow extends BaseTask
{
- public static $description = '批量清理选定分组关注,默认单次最大清理300个关注.';
+ public static $description = '批量清理选定分组关注,默认单次最大清理600个关注.';
/**
* @throws \Exception