From 7a52a144e652ea376e66108d982595572d1c8b34 Mon Sep 17 00:00:00 2001
From: lkeme <1462364497@qq.com>
Date: Tue, 19 Jan 2021 14:32:18 +0800
Subject: [PATCH] [update] Version 0.7.0
---
DOC.md | 58 ++++----
README.md | 2 +-
conf/ConfigGenerator.php | 2 +-
index.php | 2 +-
src/core/App.php | 2 +-
src/core/Config.php | 2 +-
src/core/Curl.php | 13 +-
src/core/Env.php | 9 +-
src/core/Log.php | 2 +-
src/plugin/ActivityLottery.php | 2 +-
src/plugin/AloneTcpClient.php | 2 +-
src/plugin/AnchorRaffle.php | 2 +-
src/plugin/AwardRecord.php | 2 +-
src/plugin/Barrage.php | 2 +-
src/plugin/BaseRaffle.php | 2 +-
src/plugin/Competition.php | 2 +-
src/plugin/Daily.php | 2 +-
src/plugin/DataTreating.php | 2 +-
src/plugin/GiftHeart.php | 2 +-
src/plugin/GiftRaffle.php | 2 +-
src/plugin/GiftSend.php | 2 +-
src/plugin/GroupSignIn.php | 2 +-
src/plugin/GuardRaffle.php | 2 +-
src/plugin/Heart.php | 2 +-
src/plugin/Judge.php | 2 +-
src/plugin/Live.php | 2 +-
src/plugin/Login.php | 5 +-
src/plugin/ManGa.php | 2 +-
src/plugin/MasterSite.php | 2 +-
src/plugin/Match.php | 2 +-
src/plugin/MaterialObject.php | 4 +-
src/plugin/Notice.php | 2 +-
src/plugin/PkRaffle.php | 2 +-
src/plugin/Schedule.php | 2 +-
src/plugin/Sign.php | 2 +-
src/plugin/Silver.php | 2 +-
src/plugin/Silver2Coin.php | 2 +-
src/plugin/SmallHeart.php | 13 +-
src/plugin/Statistics.php | 2 +-
src/plugin/StormRaffle.php | 2 +-
src/plugin/Task.php | 2 +-
src/plugin/User.php | 2 +-
src/plugin/ZoneTcpClient.php | 2 +-
src/tool/BvToAv.php | 2 +-
src/tool/DumpMemory.php | 2 +-
src/tool/Faker.php | 238 +++++++++++++++++++++++++++++++++
src/tool/Generator.php | 14 +-
src/util/TimeLock.php | 2 +-
48 files changed, 351 insertions(+), 83 deletions(-)
create mode 100644 src/tool/Faker.php
diff --git a/DOC.md b/DOC.md
index cc397dd..7ea9f5e 100644
--- a/DOC.md
+++ b/DOC.md
@@ -2,7 +2,7 @@

-
+
@@ -15,34 +15,34 @@ B 站直播实用脚本
|plugin |version |description |
|--------------------|--------------------|--------------------|
-|Login |20.08.08 |账号登录 |
-|Schedule |20.08.08 |休眠控制 |
-|MasterSite |20.08.08 |主站助手 |
-|Daily |20.08.08 |每日礼包 |
-|Heart |20.08.08 |双端心跳 |
-|Task |20.08.08 |每日任务 |
-|Silver |20.08.08 |银瓜子宝箱 |
-|Barrage |20.08.08 |活跃弹幕 |
-|Silver2Coin |20.08.08 |银瓜子换硬币 |
-|GiftSend |20.08.08 |礼物赠送 |
-|Judge |20.08.08 |风纪 |
-|GroupSignIn |20.08.08 |友爱社签到 |
-|ManGa |20.08.08 |漫画签到分享 |
-|Match |20.08.08 |赛事签到分享 |
-|GiftHeart |20.08.08 |心跳礼物 |
-|MaterialObject |20.08.08 |实物抽奖 |
-|AloneTcpClient |20.08.08 |独立监控 |
-|ZoneTcpClient |20.08.08 |分区监控 |
-|StormRaffle |20.08.08 |节奏风暴 |
-|GiftRaffle |20.08.08 |活动礼物 |
-|PkRaffle |20.08.08 |大乱斗 |
-|GuardRaffle |20.08.08 |舰长总督 |
-|AnchorRaffle |20.08.08 |天选时刻 |
-|AwardRecord |20.08.08 |获奖通知 |
-|Statistics |20.08.08 |数据统计 |
-|Competition |20.08.08 |赛事竞猜 |
-|SmallHeart |20.08.08 |小心心 |
-|ActivityLottery |20.08.08 |主站活动 |
+|Login |21.01.19 |账号登录 |
+|Schedule |21.01.19 |休眠控制 |
+|MasterSite |21.01.19 |主站助手 |
+|Daily |21.01.19 |每日礼包 |
+|Heart |21.01.19 |双端心跳 |
+|Task |21.01.19 |每日任务 |
+|Silver |21.01.19 |银瓜子宝箱 |
+|Barrage |21.01.19 |活跃弹幕 |
+|Silver2Coin |21.01.19 |银瓜子换硬币 |
+|GiftSend |21.01.19 |礼物赠送 |
+|Judge |21.01.19 |风纪 |
+|GroupSignIn |21.01.19 |友爱社签到 |
+|ManGa |21.01.19 |漫画签到分享 |
+|Match |21.01.19 |赛事签到分享 |
+|GiftHeart |21.01.19 |心跳礼物 |
+|MaterialObject |21.01.19 |实物抽奖 |
+|AloneTcpClient |21.01.19 |独立监控 |
+|ZoneTcpClient |21.01.19 |分区监控 |
+|StormRaffle |21.01.19 |节奏风暴 |
+|GiftRaffle |21.01.19 |活动礼物 |
+|PkRaffle |21.01.19 |大乱斗 |
+|GuardRaffle |21.01.19 |舰长总督 |
+|AnchorRaffle |21.01.19 |天选时刻 |
+|AwardRecord |21.01.19 |获奖通知 |
+|Statistics |21.01.19 |数据统计 |
+|Competition |21.01.19 |赛事竞猜 |
+|SmallHeart |21.01.19 |小心心 |
+|ActivityLottery |21.01.19 |主站活动 |
## 打赏赞助
diff --git a/README.md b/README.md
index e3fd0c0..4d4d8f8 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ Group: [55308141](https://jq.qq.com/?_wv=1027&k=5AIDaJg) | **仅用于BUG提交
## 公告
-> Currently for Personal Edition **0.6.7.201117 alpha**
+> Currently for Personal Edition **0.7.0.210119 alpha**
```notice
---- 免费的东西总是得不到人的珍惜。
diff --git a/conf/ConfigGenerator.php b/conf/ConfigGenerator.php
index d6400fd..381b5be 100644
--- a/conf/ConfigGenerator.php
+++ b/conf/ConfigGenerator.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
* Source: https://github.com/NeverBehave/BilibiliHelper
*/
diff --git a/index.php b/index.php
index ecdd05f..803addb 100644
--- a/index.php
+++ b/index.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
diff --git a/src/core/App.php b/src/core/App.php
index 93ada16..de4255e 100644
--- a/src/core/App.php
+++ b/src/core/App.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Core;
diff --git a/src/core/Config.php b/src/core/Config.php
index dc52fa1..965db0a 100644
--- a/src/core/Config.php
+++ b/src/core/Config.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Core;
diff --git a/src/core/Curl.php b/src/core/Curl.php
index 67c42aa..467b65c 100644
--- a/src/core/Curl.php
+++ b/src/core/Curl.php
@@ -5,17 +5,20 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Core;
+use BiliHelper\Tool\Generator;
+
class Curl
{
private static $client;
private static $async_opt;
private static $results = [];
private static $result = [];
+ private static $buvid = '';
/**
* @use POST请求
@@ -227,14 +230,20 @@ class Curl
*/
private static function getHeaders(string $os = 'app', array $headers = []): array
{
+ if (!self::$buvid) {
+ self::$buvid = Generator::buvid();
+ }
$app_headers = [
+ 'env' => 'prod',
+ 'APP-KEY' => 'android',
+ 'Buvid' => self::$buvid,
'Accept' => '*/*',
'Accept-Encoding' => 'gzip',
'Accept-Language' => 'zh-cn',
'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.3.0 (bbcallen@gmail.com) os/android model/MuMu mobi_app/android build/6030600 channel/bili innerVer/6030600 osVer/6.0.1 network/2',
+ 'User-Agent' => 'Mozilla/5.0 BiliDroid/6.17.1 (bbcallen@gmail.com) os/android model/MuMu mobi_app/android build/6171000 channel/bili innerVer/6171000 osVer/6.0.1 network/2',
// 'Referer' => 'https://live.bilibili.com/',
];
$pc_headers = [
diff --git a/src/core/Env.php b/src/core/Env.php
index ade0ce6..3a0020b 100644
--- a/src/core/Env.php
+++ b/src/core/Env.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Core;
@@ -13,7 +13,7 @@ namespace BiliHelper\Core;
class Env
{
private $app_name = 'BiliHelper Personal';
- private $app_version = '0.6.7.*';
+ private $app_version = '0.7.0.*';
/**
* Env constructor.
@@ -56,7 +56,10 @@ class Env
die("Please run this script from command line .");
}
if (version_compare(PHP_VERSION, '7.0.0', '<')) {
- die("Please upgrade PHP version >= 7.0.0 .");
+ die("Please upgrade PHP version > 7.0.0 .");
+ }
+ if (version_compare(PHP_VERSION, '8.0.0', '>')) {
+ die("Please upgrade PHP version < 8.0.0 .");
}
return $this;
}
diff --git a/src/core/Log.php b/src/core/Log.php
index d0db464..d7d8dab 100644
--- a/src/core/Log.php
+++ b/src/core/Log.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Core;
diff --git a/src/plugin/ActivityLottery.php b/src/plugin/ActivityLottery.php
index 644044a..c930959 100644
--- a/src/plugin/ActivityLottery.php
+++ b/src/plugin/ActivityLottery.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/AloneTcpClient.php b/src/plugin/AloneTcpClient.php
index 6a9d1fa..a4c6e3d 100644
--- a/src/plugin/AloneTcpClient.php
+++ b/src/plugin/AloneTcpClient.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/AnchorRaffle.php b/src/plugin/AnchorRaffle.php
index 06b6bf0..97a9722 100644
--- a/src/plugin/AnchorRaffle.php
+++ b/src/plugin/AnchorRaffle.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/AwardRecord.php b/src/plugin/AwardRecord.php
index c3c4c45..3a30903 100644
--- a/src/plugin/AwardRecord.php
+++ b/src/plugin/AwardRecord.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/Barrage.php b/src/plugin/Barrage.php
index e5c0ddd..835048f 100644
--- a/src/plugin/Barrage.php
+++ b/src/plugin/Barrage.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/BaseRaffle.php b/src/plugin/BaseRaffle.php
index cd488eb..7e1149d 100644
--- a/src/plugin/BaseRaffle.php
+++ b/src/plugin/BaseRaffle.php
@@ -6,7 +6,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/Competition.php b/src/plugin/Competition.php
index aba68e9..8475ae0 100644
--- a/src/plugin/Competition.php
+++ b/src/plugin/Competition.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/Daily.php b/src/plugin/Daily.php
index 6a149ba..5a85b1c 100644
--- a/src/plugin/Daily.php
+++ b/src/plugin/Daily.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/DataTreating.php b/src/plugin/DataTreating.php
index df78789..1faef3b 100644
--- a/src/plugin/DataTreating.php
+++ b/src/plugin/DataTreating.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/GiftHeart.php b/src/plugin/GiftHeart.php
index fb818cb..d7ae5ce 100644
--- a/src/plugin/GiftHeart.php
+++ b/src/plugin/GiftHeart.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/GiftRaffle.php b/src/plugin/GiftRaffle.php
index 3af8831..9f8364c 100644
--- a/src/plugin/GiftRaffle.php
+++ b/src/plugin/GiftRaffle.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/GiftSend.php b/src/plugin/GiftSend.php
index 5aaa2ee..fd2f588 100644
--- a/src/plugin/GiftSend.php
+++ b/src/plugin/GiftSend.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/GroupSignIn.php b/src/plugin/GroupSignIn.php
index 214bfb2..92e3304 100644
--- a/src/plugin/GroupSignIn.php
+++ b/src/plugin/GroupSignIn.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/GuardRaffle.php b/src/plugin/GuardRaffle.php
index 0b41c45..84b28d7 100644
--- a/src/plugin/GuardRaffle.php
+++ b/src/plugin/GuardRaffle.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/Heart.php b/src/plugin/Heart.php
index 6e27939..e8cec6f 100644
--- a/src/plugin/Heart.php
+++ b/src/plugin/Heart.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/Judge.php b/src/plugin/Judge.php
index 595655b..521507a 100644
--- a/src/plugin/Judge.php
+++ b/src/plugin/Judge.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/Live.php b/src/plugin/Live.php
index e64204c..37ab03d 100644
--- a/src/plugin/Live.php
+++ b/src/plugin/Live.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/Login.php b/src/plugin/Login.php
index c4b5479..e45d7ab 100644
--- a/src/plugin/Login.php
+++ b/src/plugin/Login.php
@@ -4,7 +4,7 @@
* Website: https://mudew.com/
* Author: Lkeme
* License: The MIT License
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
@@ -291,7 +291,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';
+// $url = 'https://passport.bilibili.com/api/v3/oauth2/login';
+ $url = 'https://passport.bilibili.com/x/passport-login/oauth2/login';
$payload = [
'seccode' => $validate ? "{$validate}|jordan" : '',
'validate' => $validate,
diff --git a/src/plugin/ManGa.php b/src/plugin/ManGa.php
index 89ecea8..0c5cfdb 100644
--- a/src/plugin/ManGa.php
+++ b/src/plugin/ManGa.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/MasterSite.php b/src/plugin/MasterSite.php
index 1d39356..83612ad 100644
--- a/src/plugin/MasterSite.php
+++ b/src/plugin/MasterSite.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/Match.php b/src/plugin/Match.php
index cc8e973..12ef0bc 100644
--- a/src/plugin/Match.php
+++ b/src/plugin/Match.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/MaterialObject.php b/src/plugin/MaterialObject.php
index b1aab3b..b7d0f0d 100644
--- a/src/plugin/MaterialObject.php
+++ b/src/plugin/MaterialObject.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
@@ -32,7 +32,7 @@ class MaterialObject
return;
}
// TODO 优化计算AID算法
- self::calcAid(470, 770);
+ self::calcAid(650, 850);
$lottery_list = self::fetchLottery();
self::drawLottery($lottery_list);
self::setLock(mt_rand(6, 10) * 60);
diff --git a/src/plugin/Notice.php b/src/plugin/Notice.php
index f092e83..b2c34b2 100644
--- a/src/plugin/Notice.php
+++ b/src/plugin/Notice.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/PkRaffle.php b/src/plugin/PkRaffle.php
index c6bb135..952d708 100644
--- a/src/plugin/PkRaffle.php
+++ b/src/plugin/PkRaffle.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/Schedule.php b/src/plugin/Schedule.php
index 4563193..5e4dfeb 100644
--- a/src/plugin/Schedule.php
+++ b/src/plugin/Schedule.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/Sign.php b/src/plugin/Sign.php
index e4aeb81..3ff225f 100644
--- a/src/plugin/Sign.php
+++ b/src/plugin/Sign.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/Silver.php b/src/plugin/Silver.php
index c49e5a9..80e8a46 100644
--- a/src/plugin/Silver.php
+++ b/src/plugin/Silver.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/Silver2Coin.php b/src/plugin/Silver2Coin.php
index d351903..d737236 100644
--- a/src/plugin/Silver2Coin.php
+++ b/src/plugin/Silver2Coin.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/SmallHeart.php b/src/plugin/SmallHeart.php
index 8ffa1ec..ab1a9e0 100644
--- a/src/plugin/SmallHeart.php
+++ b/src/plugin/SmallHeart.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
@@ -13,6 +13,7 @@ namespace BiliHelper\Plugin;
use BiliHelper\Core\Log;
use BiliHelper\Core\Curl;
+use BiliHelper\Tool\Faker;
use BiliHelper\Util\TimeLock;
use BiliHelper\Tool\Generator;
@@ -48,7 +49,7 @@ class SmallHeart
if (self::getLock() < time()) {
self::heartBeat();
if (self::$hb_count >= 200) {
- self::resetVar();
+ self::resetVar(true);
self::setLock(self::timing(2));
} else {
self::setLock(self::$heartbeat_interval);
@@ -56,15 +57,19 @@ class SmallHeart
}
}
+
/**
* @use 重置变量
+ * @param false $reset_num
*/
- private static function resetVar()
+ private static function resetVar($reset_num = false)
{
self::$hb_payload = []; // 心跳请求数据
self::$hb_headers = []; // 心跳请求头
- self::$hb_count = 0; // 心跳次数 max 24
+ if ($reset_num) {
+ self::$hb_count = 0; // 心跳次数 max 24
+ }
self::$hb_room_info = []; // 心跳带勋章房间信息
self::$heartbeat_interval = 60; // 跳变时间
diff --git a/src/plugin/Statistics.php b/src/plugin/Statistics.php
index fd7551c..1dd2431 100644
--- a/src/plugin/Statistics.php
+++ b/src/plugin/Statistics.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/StormRaffle.php b/src/plugin/StormRaffle.php
index bd50464..151b91d 100644
--- a/src/plugin/StormRaffle.php
+++ b/src/plugin/StormRaffle.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/Task.php b/src/plugin/Task.php
index 1a88d12..64e2690 100644
--- a/src/plugin/Task.php
+++ b/src/plugin/Task.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/User.php b/src/plugin/User.php
index f08c470..21031d0 100644
--- a/src/plugin/User.php
+++ b/src/plugin/User.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/plugin/ZoneTcpClient.php b/src/plugin/ZoneTcpClient.php
index 87744a0..47d5d78 100644
--- a/src/plugin/ZoneTcpClient.php
+++ b/src/plugin/ZoneTcpClient.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Plugin;
diff --git a/src/tool/BvToAv.php b/src/tool/BvToAv.php
index 9ca26c6..64f740d 100644
--- a/src/tool/BvToAv.php
+++ b/src/tool/BvToAv.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
* Source: https://github.com/anhao/bv2av/
*/
diff --git a/src/tool/DumpMemory.php b/src/tool/DumpMemory.php
index a99dca9..a5615d4 100644
--- a/src/tool/DumpMemory.php
+++ b/src/tool/DumpMemory.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
* Source: https://github.com/anhao/bv2av/
*/
diff --git a/src/tool/Faker.php b/src/tool/Faker.php
new file mode 100644
index 0000000..d1e7c41
--- /dev/null
+++ b/src/tool/Faker.php
@@ -0,0 +1,238 @@
+= $except) {
+ $result++;
+ }
+ return $result;
+ }
+
+ /**
+ * Replaces * signs with random numbers and letters and special characters
+ *
+ * @example $faker->asciify(''********'); // "s5'G!uC3"
+ *
+ * @param string $string String that needs to bet parsed
+ * @return string
+ */
+ public static function asciify($string = '****')
+ {
+ return preg_replace_callback('/\*/u', 'static::randomAscii', $string);
+ }
+
+
+ /**
+ * @example 'fY4èHdZv68'
+ */
+ public function password($minLength = 6, $maxLength = 20)
+ {
+ $pattern = str_repeat('*', $this->numberBetween($minLength, $maxLength));
+
+ return $this->asciify($pattern);
+ }
+
+
+ /**
+ * @example '237.149.115.38'
+ */
+ public function ipv4()
+ {
+ return long2ip(mt_rand(0, 1) == 0 ? mt_rand(-2147483648, -2) : mt_rand(16777216, 2147483647));
+ }
+
+ /**
+ * @example '35cd:186d:3e23:2986:ef9f:5b41:42a4:e6f1'
+ */
+ public function ipv6()
+ {
+ $res = array();
+ for ($i = 0; $i < 8; $i++) {
+ $res [] = dechex(mt_rand(0, "65535"));
+ }
+
+ return join(':', $res);
+ }
+
+ /**
+ * @example '10.1.1.17'
+ */
+ public static function localIpv4()
+ {
+ if (static::numberBetween(0, 1) === 0) {
+ // 10.x.x.x range
+ return long2ip(static::numberBetween(ip2long("10.0.0.0"), ip2long("10.255.255.255")));
+ }
+
+ // 192.168.x.x range
+ return long2ip(static::numberBetween(ip2long("192.168.0.0"), ip2long("192.168.255.255")));
+ }
+
+ /**
+ * @example '32:F1:39:2F:D6:18'
+ */
+ public static function macAddress()
+ {
+ for ($i = 0; $i < 6; $i++) {
+ $mac[] = sprintf('%02X', static::numberBetween(0, 0xff));
+ }
+ $mac = implode(':', $mac);
+
+ return $mac;
+ }
+
+ protected static function toAscii($string)
+ {
+ static $arrayFrom, $arrayTo;
+
+ if (empty($arrayFrom)) {
+ $transliterationTable = array(
+ 'IJ' => 'I', 'Ö' => 'O', 'Œ' => 'O', 'Ü' => 'U', 'ä' => 'a', 'æ' => 'a',
+ 'ij' => 'i', 'ö' => 'o', 'œ' => 'o', 'ü' => 'u', 'ß' => 's', 'ſ' => 's',
+ 'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A',
+ 'Æ' => 'A', 'Ā' => 'A', 'Ą' => 'A', 'Ă' => 'A', 'Ç' => 'C', 'Ć' => 'C',
+ 'Č' => 'C', 'Ĉ' => 'C', 'Ċ' => 'C', 'Ď' => 'D', 'Đ' => 'D', 'È' => 'E',
+ 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', 'Ē' => 'E', 'Ę' => 'E', 'Ě' => 'E',
+ 'Ĕ' => 'E', 'Ė' => 'E', 'Ĝ' => 'G', 'Ğ' => 'G', 'Ġ' => 'G', 'Ģ' => 'G',
+ 'Ĥ' => 'H', 'Ħ' => 'H', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I',
+ 'Ī' => 'I', 'Ĩ' => 'I', 'Ĭ' => 'I', 'Į' => 'I', 'İ' => 'I', 'Ĵ' => 'J',
+ 'Ķ' => 'K', 'Ľ' => 'K', 'Ĺ' => 'K', 'Ļ' => 'K', 'Ŀ' => 'K', 'Ł' => 'L',
+ 'Ñ' => 'N', 'Ń' => 'N', 'Ň' => 'N', 'Ņ' => 'N', 'Ŋ' => 'N', 'Ò' => 'O',
+ 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ø' => 'O', 'Ō' => 'O', 'Ő' => 'O',
+ 'Ŏ' => 'O', 'Ŕ' => 'R', 'Ř' => 'R', 'Ŗ' => 'R', 'Ś' => 'S', 'Ş' => 'S',
+ 'Ŝ' => 'S', 'Ș' => 'S', 'Š' => 'S', 'Ť' => 'T', 'Ţ' => 'T', 'Ŧ' => 'T',
+ 'Ț' => 'T', 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ū' => 'U', 'Ů' => 'U',
+ 'Ű' => 'U', 'Ŭ' => 'U', 'Ũ' => 'U', 'Ų' => 'U', 'Ŵ' => 'W', 'Ŷ' => 'Y',
+ 'Ÿ' => 'Y', 'Ý' => 'Y', 'Ź' => 'Z', 'Ż' => 'Z', 'Ž' => 'Z', 'à' => 'a',
+ 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ā' => 'a', 'ą' => 'a', 'ă' => 'a',
+ 'å' => 'a', 'ç' => 'c', 'ć' => 'c', 'č' => 'c', 'ĉ' => 'c', 'ċ' => 'c',
+ 'ď' => 'd', 'đ' => 'd', 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e',
+ 'ē' => 'e', 'ę' => 'e', 'ě' => 'e', 'ĕ' => 'e', 'ė' => 'e', 'ƒ' => 'f',
+ 'ĝ' => 'g', 'ğ' => 'g', 'ġ' => 'g', 'ģ' => 'g', 'ĥ' => 'h', 'ħ' => 'h',
+ 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ī' => 'i', 'ĩ' => 'i',
+ 'ĭ' => 'i', 'į' => 'i', 'ı' => 'i', 'ĵ' => 'j', 'ķ' => 'k', 'ĸ' => 'k',
+ 'ł' => 'l', 'ľ' => 'l', 'ĺ' => 'l', 'ļ' => 'l', 'ŀ' => 'l', 'ñ' => 'n',
+ 'ń' => 'n', 'ň' => 'n', 'ņ' => 'n', 'ʼn' => 'n', 'ŋ' => 'n', 'ò' => 'o',
+ 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ø' => 'o', 'ō' => 'o', 'ő' => 'o',
+ 'ŏ' => 'o', 'ŕ' => 'r', 'ř' => 'r', 'ŗ' => 'r', 'ś' => 's', 'š' => 's',
+ 'ť' => 't', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ū' => 'u', 'ů' => 'u',
+ 'ű' => 'u', 'ŭ' => 'u', 'ũ' => 'u', 'ų' => 'u', 'ŵ' => 'w', 'ÿ' => 'y',
+ 'ý' => 'y', 'ŷ' => 'y', 'ż' => 'z', 'ź' => 'z', 'ž' => 'z', 'Α' => 'A',
+ 'Ά' => 'A', 'Ἀ' => 'A', 'Ἁ' => 'A', 'Ἂ' => 'A', 'Ἃ' => 'A', 'Ἄ' => 'A',
+ 'Ἅ' => 'A', 'Ἆ' => 'A', 'Ἇ' => 'A', 'ᾈ' => 'A', 'ᾉ' => 'A', 'ᾊ' => 'A',
+ 'ᾋ' => 'A', 'ᾌ' => 'A', 'ᾍ' => 'A', 'ᾎ' => 'A', 'ᾏ' => 'A', 'Ᾰ' => 'A',
+ 'Ᾱ' => 'A', 'Ὰ' => 'A', 'ᾼ' => 'A', 'Β' => 'B', 'Γ' => 'G', 'Δ' => 'D',
+ 'Ε' => 'E', 'Έ' => 'E', 'Ἐ' => 'E', 'Ἑ' => 'E', 'Ἒ' => 'E', 'Ἓ' => 'E',
+ 'Ἔ' => 'E', 'Ἕ' => 'E', 'Ὲ' => 'E', 'Ζ' => 'Z', 'Η' => 'I', 'Ή' => 'I',
+ 'Ἠ' => 'I', 'Ἡ' => 'I', 'Ἢ' => 'I', 'Ἣ' => 'I', 'Ἤ' => 'I', 'Ἥ' => 'I',
+ 'Ἦ' => 'I', 'Ἧ' => 'I', 'ᾘ' => 'I', 'ᾙ' => 'I', 'ᾚ' => 'I', 'ᾛ' => 'I',
+ 'ᾜ' => 'I', 'ᾝ' => 'I', 'ᾞ' => 'I', 'ᾟ' => 'I', 'Ὴ' => 'I', 'ῌ' => 'I',
+ 'Θ' => 'T', 'Ι' => 'I', 'Ί' => 'I', 'Ϊ' => 'I', 'Ἰ' => 'I', 'Ἱ' => 'I',
+ 'Ἲ' => 'I', 'Ἳ' => 'I', 'Ἴ' => 'I', 'Ἵ' => 'I', 'Ἶ' => 'I', 'Ἷ' => 'I',
+ 'Ῐ' => 'I', 'Ῑ' => 'I', 'Ὶ' => 'I', 'Κ' => 'K', 'Λ' => 'L', 'Μ' => 'M',
+ 'Ν' => 'N', 'Ξ' => 'K', 'Ο' => 'O', 'Ό' => 'O', 'Ὀ' => 'O', 'Ὁ' => 'O',
+ 'Ὂ' => 'O', 'Ὃ' => 'O', 'Ὄ' => 'O', 'Ὅ' => 'O', 'Ὸ' => 'O', 'Π' => 'P',
+ 'Ρ' => 'R', 'Ῥ' => 'R', 'Σ' => 'S', 'Τ' => 'T', 'Υ' => 'Y', 'Ύ' => 'Y',
+ 'Ϋ' => 'Y', 'Ὑ' => 'Y', 'Ὓ' => 'Y', 'Ὕ' => 'Y', 'Ὗ' => 'Y', 'Ῠ' => 'Y',
+ 'Ῡ' => 'Y', 'Ὺ' => 'Y', 'Φ' => 'F', 'Χ' => 'X', 'Ψ' => 'P', 'Ω' => 'O',
+ 'Ώ' => 'O', 'Ὠ' => 'O', 'Ὡ' => 'O', 'Ὢ' => 'O', 'Ὣ' => 'O', 'Ὤ' => 'O',
+ 'Ὥ' => 'O', 'Ὦ' => 'O', 'Ὧ' => 'O', 'ᾨ' => 'O', 'ᾩ' => 'O', 'ᾪ' => 'O',
+ 'ᾫ' => 'O', 'ᾬ' => 'O', 'ᾭ' => 'O', 'ᾮ' => 'O', 'ᾯ' => 'O', 'Ὼ' => 'O',
+ 'ῼ' => 'O', 'α' => 'a', 'ά' => 'a', 'ἀ' => 'a', 'ἁ' => 'a', 'ἂ' => 'a',
+ 'ἃ' => 'a', 'ἄ' => 'a', 'ἅ' => 'a', 'ἆ' => 'a', 'ἇ' => 'a', 'ᾀ' => 'a',
+ 'ᾁ' => 'a', 'ᾂ' => 'a', 'ᾃ' => 'a', 'ᾄ' => 'a', 'ᾅ' => 'a', 'ᾆ' => 'a',
+ 'ᾇ' => 'a', 'ὰ' => 'a', 'ᾰ' => 'a', 'ᾱ' => 'a', 'ᾲ' => 'a', 'ᾳ' => 'a',
+ 'ᾴ' => 'a', 'ᾶ' => 'a', 'ᾷ' => 'a', 'β' => 'b', 'γ' => 'g', 'δ' => 'd',
+ 'ε' => 'e', 'έ' => 'e', 'ἐ' => 'e', 'ἑ' => 'e', 'ἒ' => 'e', 'ἓ' => 'e',
+ 'ἔ' => 'e', 'ἕ' => 'e', 'ὲ' => 'e', 'ζ' => 'z', 'η' => 'i', 'ή' => 'i',
+ 'ἠ' => 'i', 'ἡ' => 'i', 'ἢ' => 'i', 'ἣ' => 'i', 'ἤ' => 'i', 'ἥ' => 'i',
+ 'ἦ' => 'i', 'ἧ' => 'i', 'ᾐ' => 'i', 'ᾑ' => 'i', 'ᾒ' => 'i', 'ᾓ' => 'i',
+ 'ᾔ' => 'i', 'ᾕ' => 'i', 'ᾖ' => 'i', 'ᾗ' => 'i', 'ὴ' => 'i', 'ῂ' => 'i',
+ 'ῃ' => 'i', 'ῄ' => 'i', 'ῆ' => 'i', 'ῇ' => 'i', 'θ' => 't', 'ι' => 'i',
+ 'ί' => 'i', 'ϊ' => 'i', 'ΐ' => 'i', 'ἰ' => 'i', 'ἱ' => 'i', 'ἲ' => 'i',
+ 'ἳ' => 'i', 'ἴ' => 'i', 'ἵ' => 'i', 'ἶ' => 'i', 'ἷ' => 'i', 'ὶ' => 'i',
+ 'ῐ' => 'i', 'ῑ' => 'i', 'ῒ' => 'i', 'ῖ' => 'i', 'ῗ' => 'i', 'κ' => 'k',
+ 'λ' => 'l', 'μ' => 'm', 'ν' => 'n', 'ξ' => 'k', 'ο' => 'o', 'ό' => 'o',
+ 'ὀ' => 'o', 'ὁ' => 'o', 'ὂ' => 'o', 'ὃ' => 'o', 'ὄ' => 'o', 'ὅ' => 'o',
+ 'ὸ' => 'o', 'π' => 'p', 'ρ' => 'r', 'ῤ' => 'r', 'ῥ' => 'r', 'σ' => 's',
+ 'ς' => 's', 'τ' => 't', 'υ' => 'y', 'ύ' => 'y', 'ϋ' => 'y', 'ΰ' => 'y',
+ 'ὐ' => 'y', 'ὑ' => 'y', 'ὒ' => 'y', 'ὓ' => 'y', 'ὔ' => 'y', 'ὕ' => 'y',
+ 'ὖ' => 'y', 'ὗ' => 'y', 'ὺ' => 'y', 'ῠ' => 'y', 'ῡ' => 'y', 'ῢ' => 'y',
+ 'ῦ' => 'y', 'ῧ' => 'y', 'φ' => 'f', 'χ' => 'x', 'ψ' => 'p', 'ω' => 'o',
+ 'ώ' => 'o', 'ὠ' => 'o', 'ὡ' => 'o', 'ὢ' => 'o', 'ὣ' => 'o', 'ὤ' => 'o',
+ 'ὥ' => 'o', 'ὦ' => 'o', 'ὧ' => 'o', 'ᾠ' => 'o', 'ᾡ' => 'o', 'ᾢ' => 'o',
+ 'ᾣ' => 'o', 'ᾤ' => 'o', 'ᾥ' => 'o', 'ᾦ' => 'o', 'ᾧ' => 'o', 'ὼ' => 'o',
+ 'ῲ' => 'o', 'ῳ' => 'o', 'ῴ' => 'o', 'ῶ' => 'o', 'ῷ' => 'o', 'А' => 'A',
+ 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Д' => 'D', 'Е' => 'E', 'Ё' => 'E',
+ 'Ж' => 'Z', 'З' => 'Z', 'И' => 'I', 'Й' => 'I', 'К' => 'K', 'Л' => 'L',
+ 'М' => 'M', 'Н' => 'N', 'О' => 'O', 'П' => 'P', 'Р' => 'R', 'С' => 'S',
+ 'Т' => 'T', 'У' => 'U', 'Ф' => 'F', 'Х' => 'K', 'Ц' => 'T', 'Ч' => 'C',
+ 'Ш' => 'S', 'Щ' => 'S', 'Ы' => 'Y', 'Э' => 'E', 'Ю' => 'Y', 'Я' => 'Y',
+ 'а' => 'A', 'б' => 'B', 'в' => 'V', 'г' => 'G', 'д' => 'D', 'е' => 'E',
+ 'ё' => 'E', 'ж' => 'Z', 'з' => 'Z', 'и' => 'I', 'й' => 'I', 'к' => 'K',
+ 'л' => 'L', 'м' => 'M', 'н' => 'N', 'о' => 'O', 'п' => 'P', 'р' => 'R',
+ 'с' => 'S', 'т' => 'T', 'у' => 'U', 'ф' => 'F', 'х' => 'K', 'ц' => 'T',
+ 'ч' => 'C', 'ш' => 'S', 'щ' => 'S', 'ы' => 'Y', 'э' => 'E', 'ю' => 'Y',
+ 'я' => 'Y', 'ð' => 'd', 'Ð' => 'D', 'þ' => 't', 'Þ' => 'T', 'ა' => 'a',
+ 'ბ' => 'b', 'გ' => 'g', 'დ' => 'd', 'ე' => 'e', 'ვ' => 'v', 'ზ' => 'z',
+ 'თ' => 't', 'ი' => 'i', 'კ' => 'k', 'ლ' => 'l', 'მ' => 'm', 'ნ' => 'n',
+ 'ო' => 'o', 'პ' => 'p', 'ჟ' => 'z', 'რ' => 'r', 'ს' => 's', 'ტ' => 't',
+ 'უ' => 'u', 'ფ' => 'p', 'ქ' => 'k', 'ღ' => 'g', 'ყ' => 'q', 'შ' => 's',
+ 'ჩ' => 'c', 'ც' => 't', 'ძ' => 'd', 'წ' => 't', 'ჭ' => 'c', 'ხ' => 'k',
+ 'ჯ' => 'j', 'ჰ' => 'h', 'ţ' => 't', 'ʼ' => "'", '̧' => '', 'ḩ' => 'h',
+ '‘' => "'", '’' => "'", 'ừ' => 'u', '/' => '', 'ế' => 'e', 'ả' => 'a',
+ 'ị' => 'i', 'ậ' => 'a', 'ệ' => 'e', 'ỉ' => 'i', 'ồ' => 'o', 'ề' => 'e',
+ 'ơ' => 'o', 'ạ' => 'a', 'ẵ' => 'a', 'ư' => 'u', 'ằ' => 'a', 'ầ' => 'a',
+ 'ḑ' => 'd', 'Ḩ' => 'H', 'Ḑ' => 'D', 'ș' => 's', 'ț' => 't', 'ộ' => 'o',
+ 'ắ' => 'a', 'ş' => 's', "'" => '', 'ու' => 'u', 'ա' => 'a', 'բ' => 'b',
+ 'գ' => 'g', 'դ' => 'd', 'ե' => 'e', 'զ' => 'z', 'է' => 'e', 'ը' => 'y',
+ 'թ' => 't', 'ժ' => 'zh', 'ի' => 'i', 'լ' => 'l', 'խ' => 'kh', 'ծ' => 'ts',
+ 'կ' => 'k', 'հ' => 'h', 'ձ' => 'dz', 'ղ' => 'gh', 'ճ' => 'ch', 'մ' => 'm',
+ 'յ' => 'y', 'ն' => 'n', 'շ' => 'sh', 'ո' => 'o', 'չ' => 'ch', 'պ' => 'p',
+ 'ջ' => 'j', 'ռ' => 'r', 'ս' => 's', 'վ' => 'v', 'տ' => 't', 'ր' => 'r',
+ 'ց' => 'ts', 'փ' => 'p', 'ք' => 'q', 'և' => 'ev', 'օ' => 'o', 'ֆ' => 'f',
+ );
+ $arrayFrom = array_keys($transliterationTable);
+ $arrayTo = array_values($transliterationTable);
+ }
+
+ return str_replace($arrayFrom, $arrayTo, $string);
+ }
+}
\ No newline at end of file
diff --git a/src/tool/Generator.php b/src/tool/Generator.php
index 0065314..3c5a65b 100644
--- a/src/tool/Generator.php
+++ b/src/tool/Generator.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
* Source: https://github.com/anhao/bv2av/
*/
@@ -49,4 +49,16 @@ class Generator
}
+ /**
+ * @use 生成BUVID
+ * @return string
+ */
+ public static function buvid():string{
+ // XYD5B85DA7212341F51C612344A6B8C6C21234
+ $mac = Faker::macAddress();
+ $md5 = md5($mac);
+ $md5_arr = str_split($md5);
+ return strtoupper("XY{$md5_arr[2]}{$md5_arr[12]}{$md5_arr[22]}{$md5}");
+ }
+
}
diff --git a/src/util/TimeLock.php b/src/util/TimeLock.php
index 7b121bb..064b59c 100644
--- a/src/util/TimeLock.php
+++ b/src/util/TimeLock.php
@@ -5,7 +5,7 @@
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
- * Updated: 2020 ~ 2021
+ * Updated: 2021 ~ 2022
*/
namespace BiliHelper\Util;