karin-plugin-kkk 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/lib/platform/bilibili/push.d.ts +1 -2
- package/lib/platform/bilibili/push.js +7 -26
- package/lib/platform/douyin/douyin.js +2 -4
- package/lib/platform/douyin/push.d.ts +6 -1
- package/lib/platform/douyin/push.js +11 -25
- package/package.json +2 -2
- package/resources/template/bilibili/html/userlist.html +0 -5
- package/resources/template/douyin/html/userlist.html +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.6](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.0.5...v1.0.6) (2025-01-21)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **bilibili/douyin:** 优化用户列表渲染逻辑 ([dde7ee0](https://github.com/ikenxuan/karin-plugin-kkk/commit/dde7ee04d1f209d6da15ae06fe5e6590fae1bb1a))
|
|
9
|
+
* 移除无用导入 ([3a3aac3](https://github.com/ikenxuan/karin-plugin-kkk/commit/3a3aac37291dae65cad66f0a9fc80850ad95c265))
|
|
10
|
+
|
|
11
|
+
## [1.0.5](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.0.4...v1.0.5) (2025-01-20)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* 合辑解析 ([3cd2c9e](https://github.com/ikenxuan/karin-plugin-kkk/commit/3cd2c9e583770f624ed3ff34bf666f2dce8326f6))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Performance Improvements
|
|
20
|
+
|
|
21
|
+
* 更新解析库版本 ([6dd3a77](https://github.com/ikenxuan/karin-plugin-kkk/commit/6dd3a777ded088f00cf52cddf9d21ba2f7b88037))
|
|
22
|
+
|
|
3
23
|
## [1.0.4](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.0.3...v1.0.4) (2025-01-19)
|
|
4
24
|
|
|
5
25
|
|
|
@@ -81,9 +81,8 @@ export declare class Bilibilipush extends Base {
|
|
|
81
81
|
/**
|
|
82
82
|
* 渲染推送列表图片
|
|
83
83
|
* @param pushList B站配置文件的推送列表
|
|
84
|
-
* @param host_mid 优先展示的UP主的UID
|
|
85
84
|
* @returns
|
|
86
85
|
*/
|
|
87
|
-
renderPushList(pushList: bilibiliPushItem[]
|
|
86
|
+
renderPushList(pushList: bilibiliPushItem[]): Promise<void>;
|
|
88
87
|
}
|
|
89
88
|
export {};
|
|
@@ -536,7 +536,7 @@ export class Bilibilipush extends Base {
|
|
|
536
536
|
await this.e.reply('请发送「#kkk设置B站推送开启」以进行推送');
|
|
537
537
|
logger.info(`\n设置成功!${data.data.card.name}\nUID:${host_mid}`);
|
|
538
538
|
// 渲染状态图片
|
|
539
|
-
await this.renderPushList(config.bilibili
|
|
539
|
+
await this.renderPushList(config.bilibili);
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
else {
|
|
@@ -550,7 +550,7 @@ export class Bilibilipush extends Base {
|
|
|
550
550
|
if (Config.bilibili.push.switch === false)
|
|
551
551
|
await this.e.reply('请发送「#kkk设置B站推送开启」以进行推送');
|
|
552
552
|
// 渲染状态图片
|
|
553
|
-
await this.renderPushList(config.bilibili
|
|
553
|
+
await this.renderPushList(config.bilibili);
|
|
554
554
|
}
|
|
555
555
|
// 更新配置文件
|
|
556
556
|
Config.Modify('pushlist', 'bilibili', config.bilibili);
|
|
@@ -605,35 +605,28 @@ export class Bilibilipush extends Base {
|
|
|
605
605
|
/**
|
|
606
606
|
* 渲染推送列表图片
|
|
607
607
|
* @param pushList B站配置文件的推送列表
|
|
608
|
-
* @param host_mid 优先展示的UP主的UID
|
|
609
608
|
* @returns
|
|
610
609
|
*/
|
|
611
|
-
async renderPushList(pushList
|
|
610
|
+
async renderPushList(pushList) {
|
|
612
611
|
const groupInfo = await this.e.bot.getGroupInfo('groupId' in this.e && this.e.groupId ? this.e.groupId : '');
|
|
612
|
+
/** 排除出有e.groupId的推送用户 */
|
|
613
613
|
const filteredList = pushList.filter(item => item.group_id.some(group => group.split(':')[0] === groupInfo.groupId));
|
|
614
614
|
if (filteredList.length === 0) {
|
|
615
615
|
await this.e.reply(`当前群:${groupInfo.groupName}(${groupInfo.groupId})\n没有设置任何B站UP推送!\n可使用「#设置B站推送 + UP主UID」进行设置`);
|
|
616
|
-
return true;
|
|
617
616
|
}
|
|
618
617
|
/** 用户的今日动态列表 */
|
|
619
|
-
const DynamicList = await this.getDynamicList(filteredList);
|
|
620
618
|
const renderOpt = [];
|
|
621
|
-
for (const
|
|
622
|
-
const item = DynamicList.willbepushlist[dynamic_id];
|
|
619
|
+
for (const item of filteredList) {
|
|
623
620
|
const userInfo = await getBilibiliData('用户主页数据', Config.cookies.bilibili, { host_mid: item.host_mid });
|
|
624
621
|
renderOpt.push({
|
|
625
622
|
avatar_img: userInfo.data.card.face,
|
|
626
623
|
username: userInfo.data.card.name,
|
|
627
|
-
host_mid:
|
|
624
|
+
host_mid: userInfo.data.card.mid,
|
|
628
625
|
fans: this.count(userInfo.data.follower),
|
|
629
626
|
total_favorited: this.count(userInfo.data.like_num),
|
|
630
|
-
following_count: this.count(userInfo.data.card.attention)
|
|
631
|
-
willPushNum: 999
|
|
627
|
+
following_count: this.count(userInfo.data.card.attention)
|
|
632
628
|
});
|
|
633
629
|
}
|
|
634
|
-
// 将此次设置推送的用户排序到首位
|
|
635
|
-
if (host_mid)
|
|
636
|
-
renderOpt.sort((a, b) => (a.host_mid === host_mid ? -1 : b.host_mid === host_mid ? 1 : 0));
|
|
637
630
|
const img = await Render('bilibili/userlist', { renderOpt });
|
|
638
631
|
await this.e.reply(img);
|
|
639
632
|
}
|
|
@@ -698,15 +691,3 @@ const skipDynamic = (Dynamic_Data) => {
|
|
|
698
691
|
}
|
|
699
692
|
return false;
|
|
700
693
|
};
|
|
701
|
-
const removeDuplicateHostMid = (willBePushList) => {
|
|
702
|
-
const result = {};
|
|
703
|
-
const seenHostMids = new Set();
|
|
704
|
-
for (const key in willBePushList) {
|
|
705
|
-
const item = willBePushList[key];
|
|
706
|
-
if (!seenHostMids.has(item.host_mid)) {
|
|
707
|
-
result[key] = item;
|
|
708
|
-
seenHostMids.add(item.host_mid);
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
return result;
|
|
712
|
-
};
|
|
@@ -137,14 +137,12 @@ export class DouYin extends Base {
|
|
|
137
137
|
}
|
|
138
138
|
case 'user_mix_videos': {
|
|
139
139
|
const emojiData = await getDouyinData('Emoji数据');
|
|
140
|
-
const commentsData = await douyinComments(data.CommentsData, emojiData);
|
|
140
|
+
const commentsData = await douyinComments(data.CommentsData, Emoji(emojiData));
|
|
141
141
|
const commentImage = await Render('douyin/comment', {
|
|
142
142
|
Type: '合辑作品',
|
|
143
143
|
CommentsData: commentsData,
|
|
144
144
|
CommentLength: String(commentsData.jsonArray?.length ? commentsData.jsonArray.length : 0),
|
|
145
|
-
share_url:
|
|
146
|
-
? `https://aweme.snssdk.com/aweme/v1/play/?video_id=${data.VideoData.aweme_detail.video.play_addr.uri}&ratio=1080p&line=0`
|
|
147
|
-
: data.VideoData.aweme_detail.share_url,
|
|
145
|
+
share_url: data.LiveImageData.aweme_details[0].share_url,
|
|
148
146
|
VideoSize: '???',
|
|
149
147
|
VideoFPS: '???',
|
|
150
148
|
ImageLength: '???'
|
|
@@ -69,6 +69,11 @@ export declare class DouYinpush extends Base {
|
|
|
69
69
|
* @returns 操作成功或失败的消息字符串。
|
|
70
70
|
*/
|
|
71
71
|
setting(data: any): Promise<void>;
|
|
72
|
-
|
|
72
|
+
/**
|
|
73
|
+
* 渲染推送列表图片
|
|
74
|
+
* @param pushList 抖音推送列表
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
renderPushList(pushList: douyinPushItem[]): Promise<void>;
|
|
73
78
|
}
|
|
74
79
|
export {};
|
|
@@ -496,7 +496,7 @@ export class DouYinpush extends Base {
|
|
|
496
496
|
await this.e.reply('请发送「#kkk设置B站推送开启」以进行推送');
|
|
497
497
|
logger.info(`\n设置成功!${UserInfoData.user.nickname}\n抖音号:${user_shortid}\nsec_uid${UserInfoData.user.sec_uid}`);
|
|
498
498
|
// 渲染状态图片
|
|
499
|
-
await this.renderPushList(config.douyin
|
|
499
|
+
await this.renderPushList(config.douyin);
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
else {
|
|
@@ -510,7 +510,7 @@ export class DouYinpush extends Base {
|
|
|
510
510
|
if (Config.douyin.push.switch === false)
|
|
511
511
|
await this.e.reply('请发送「#kkk设置B站推送开启」以进行推送');
|
|
512
512
|
// 渲染状态图片
|
|
513
|
-
await this.renderPushList(config.douyin
|
|
513
|
+
await this.renderPushList(config.douyin);
|
|
514
514
|
}
|
|
515
515
|
Config.Modify('pushlist', 'douyin', config.douyin);
|
|
516
516
|
}
|
|
@@ -518,18 +518,20 @@ export class DouYinpush extends Base {
|
|
|
518
518
|
logger.error(error);
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
|
|
521
|
+
/**
|
|
522
|
+
* 渲染推送列表图片
|
|
523
|
+
* @param pushList 抖音推送列表
|
|
524
|
+
* @returns
|
|
525
|
+
*/
|
|
526
|
+
async renderPushList(pushList) {
|
|
522
527
|
const groupInfo = await this.e.bot.getGroupInfo('groupId' in this.e && this.e.groupId ? this.e.groupId : '');
|
|
528
|
+
/** 排除出有e.groupId的推送用户 */
|
|
523
529
|
const filteredList = pushList.filter(item => item.group_id.some(group => group.split(':')[0] === groupInfo.groupId));
|
|
524
530
|
if (filteredList.length === 0) {
|
|
525
531
|
await this.e.reply(`当前群:${groupInfo.groupName}(${groupInfo.groupId})\n没有设置任何抖音博主推送!\n可使用「#设置抖音推送 + 抖音号」进行设置`);
|
|
526
|
-
return true;
|
|
527
532
|
}
|
|
528
|
-
/** 用户的今日动态列表 */
|
|
529
|
-
const DynamicList = await this.getDynamicList(filteredList);
|
|
530
533
|
const renderOpt = [];
|
|
531
|
-
for (const
|
|
532
|
-
const item = DynamicList.willbepushlist[dynamic_id];
|
|
534
|
+
for (const item of filteredList) {
|
|
533
535
|
const userInfo = await getDouyinData('用户主页数据', Config.cookies.douyin, { sec_uid: item.sec_uid });
|
|
534
536
|
renderOpt.push({
|
|
535
537
|
avatar_img: userInfo.user.avatar_larger.url_list[0],
|
|
@@ -537,13 +539,9 @@ export class DouYinpush extends Base {
|
|
|
537
539
|
short_id: userInfo.user.unique_id === '' ? userInfo.user.short_id : userInfo.user.unique_id,
|
|
538
540
|
fans: this.count(userInfo.user.follower_count),
|
|
539
541
|
total_favorited: this.count(userInfo.user.total_favorited),
|
|
540
|
-
following_count: this.count(userInfo.user.following_count)
|
|
541
|
-
willPushNum: 999
|
|
542
|
+
following_count: this.count(userInfo.user.following_count)
|
|
542
543
|
});
|
|
543
544
|
}
|
|
544
|
-
// 将此次设置推送的用户排序到首位
|
|
545
|
-
if (short_id)
|
|
546
|
-
renderOpt.sort((a, b) => (a.short_id === short_id ? -1 : b.short_id === short_id ? 1 : 0));
|
|
547
545
|
const img = await Render('douyin/userlist', { renderOpt });
|
|
548
546
|
await this.e.reply(img);
|
|
549
547
|
}
|
|
@@ -631,15 +629,3 @@ const findMatchingSecUid = (DBdata, secUidToCheck) => {
|
|
|
631
629
|
}
|
|
632
630
|
return '';
|
|
633
631
|
};
|
|
634
|
-
const removeDuplicateHostMid = (willBePushList) => {
|
|
635
|
-
const result = {};
|
|
636
|
-
const seenHostMids = new Set();
|
|
637
|
-
for (const key in willBePushList) {
|
|
638
|
-
const item = willBePushList[key];
|
|
639
|
-
if (!seenHostMids.has(item.sec_uid)) {
|
|
640
|
-
result[key] = item;
|
|
641
|
-
seenHostMids.add(item.sec_uid);
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
return result;
|
|
645
|
-
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "karin-plugin-kkk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "a Karin video parsing tool",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"karin-plugin",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"watch": "karin watch"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@ikenxuan/amagi": "4.2.
|
|
53
|
+
"@ikenxuan/amagi": "4.2.5",
|
|
54
54
|
"@karinjs/md-html": "^1.1.6",
|
|
55
55
|
"cors": "^2.8.5",
|
|
56
56
|
"heic-convert": "^2.1.0",
|
|
@@ -17,11 +17,6 @@
|
|
|
17
17
|
<span>关注: {{val.following_count}}</span>
|
|
18
18
|
</div>
|
|
19
19
|
</div>
|
|
20
|
-
<!-- {{if val.willPushNum > 0}}
|
|
21
|
-
<span class="pending-push active">待推送: {{val.willPushNum}}</span>
|
|
22
|
-
{{else}}
|
|
23
|
-
<span class="pending-push inactive">待推送: {{val.willPushNum}}</span>
|
|
24
|
-
{{/if}} -->
|
|
25
20
|
</div>
|
|
26
21
|
</li>
|
|
27
22
|
<div style="height: 40px;"></div>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<div class="user-details">
|
|
12
12
|
<span class="user-name">{{val.username}}</span>
|
|
13
13
|
<div class="user-stats">
|
|
14
|
-
<span
|
|
14
|
+
<span>抖音号: {{val.short_id}}</span>
|
|
15
15
|
<span>粉丝: {{val.fans}}</span>
|
|
16
16
|
<span>获赞: {{val.total_favorited}}</span>
|
|
17
17
|
<span>关注: {{val.following_count}}</span>
|