[fix] Dynamic fixed #92

This commit is contained in:
Lkeme 2021-06-25 10:57:27 +08:00
parent 70054f7430
commit b2005b1ad6
9 changed files with 124 additions and 78 deletions

View File

@ -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

View File

@ -15,7 +15,7 @@
<p align="center">
<img src="https://img.shields.io/badge/Version-0.9.5.210624-orange.svg?longCache=true&style=for-the-badge">
<img src="https://img.shields.io/badge/Version-0.9.6.210625-orange.svg?longCache=true&style=for-the-badge">
<img src="https://img.shields.io/badge/PHP-7.3+-green.svg?longCache=true&style=for-the-badge">
<img src="https://img.shields.io/badge/Composer-latest-blueviolet.svg?longCache=true&style=for-the-badge">
<img src="https://img.shields.io/badge/License-mit-blue.svg?longCache=true&style=for-the-badge">
@ -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 | 直播银瓜子自动开启宝箱 |
## 交流反馈

10
composer.lock generated
View File

@ -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",

View File

@ -11,6 +11,10 @@ password = ""
[login.mode]
mode = 1
; 校验|mode=2触发|校验国内手机号|国外手机号关闭校验
[login.check]
phone = true
; UID|CSRF|令牌|(当前区域自动生成)
[login.auth]
uid =

View File

@ -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",

View File

@ -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"
}

View File

@ -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;

View File

@ -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 {

View File

@ -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 = [