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] [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',