karin-plugin-kkk 1.0.6 → 1.0.8-pr32.022e593
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 +8 -0
- package/README.md +7 -9
- package/lib/apps/admin.js +17 -18
- package/lib/cli/pr.js +1 -1
- package/lib/module/utils/Networks.d.ts +1 -1
- package/lib/module/utils/Networks.js +10 -9
- package/lib/platform/douyin/douyin.d.ts +2 -1
- package/lib/platform/douyin/douyin.js +105 -96
- package/lib/platform/douyin/getID.js +6 -11
- package/lib/platform/douyin/push.js +1 -1
- package/package.json +2 -11
- package/resources/template/douyin/html/comment.html +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.7](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.0.6...v1.0.7) (2025-01-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* 抖音推送图集解析 ([0ccc71a](https://github.com/ikenxuan/karin-plugin-kkk/commit/0ccc71a0bdb2e302a00a28bc9bbeeee415af4dba))
|
|
9
|
+
* 移除无用导入 ([3a3aac3](https://github.com/ikenxuan/karin-plugin-kkk/commit/3a3aac37291dae65cad66f0a9fc80850ad95c265))
|
|
10
|
+
|
|
3
11
|
## [1.0.6](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.0.5...v1.0.6) (2025-01-21)
|
|
4
12
|
|
|
5
13
|
|
package/README.md
CHANGED
|
@@ -88,19 +88,17 @@ git clone https://github.com/你的GitHub用户名/karin-plugin-kkk.git
|
|
|
88
88
|
```sh
|
|
89
89
|
cd karin-plugin-kkk/
|
|
90
90
|
```
|
|
91
|
-
4.
|
|
91
|
+
4. 初始化开发环境
|
|
92
|
+
```sh
|
|
93
|
+
pnpm run init
|
|
94
|
+
```
|
|
95
|
+
5. 安装依赖
|
|
92
96
|
```sh
|
|
93
97
|
pnpm install
|
|
94
98
|
```
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
两条命令任选一条执行
|
|
98
|
-
|
|
99
|
+
6. 启动开发环境
|
|
99
100
|
```sh
|
|
100
|
-
|
|
101
|
-
pnpm ts
|
|
102
|
-
# 保存 src 目录下的文件后自动重启
|
|
103
|
-
pnpm watch
|
|
101
|
+
pnpm dev
|
|
104
102
|
```
|
|
105
103
|
</details>
|
|
106
104
|
|
package/lib/apps/admin.js
CHANGED
|
@@ -36,30 +36,29 @@ export const setbilick = karin.command(/^#?(kkk)?s*设置s*(B站)ck$/i, async (e
|
|
|
36
36
|
await e.reply('设置成功!', { at: true });
|
|
37
37
|
return true;
|
|
38
38
|
}, { perm: 'master', name: 'kkk-ck管理', event: 'message.friend' });
|
|
39
|
-
const authFailMsg = '你暂时没有这个权限使用这个功能啦 ~ 只有主人可以使用哦';
|
|
40
39
|
// 插件类
|
|
41
40
|
export class Admin extends Plugin {
|
|
42
41
|
constructor() {
|
|
43
42
|
super({
|
|
44
43
|
name: 'kkk-管理',
|
|
45
44
|
rule: [
|
|
46
|
-
{ reg: createSwitchRegExp('app'), fnc: 'ConfigSwitch', permission: 'master'
|
|
47
|
-
{ reg: createNumberRegExp('app'), fnc: 'ConfigNumber', permission: 'master'
|
|
48
|
-
{ reg: createCustomRegExp('app'), fnc: 'ConfigCustom', permission: 'master'
|
|
49
|
-
{ reg: createSwitchRegExp('douyin'), fnc: 'ConfigSwitch', permission: 'master'
|
|
50
|
-
{ reg: createNumberRegExp('douyin'), fnc: 'ConfigNumber', permission: 'master'
|
|
51
|
-
{ reg: createNumberRegExp('douyin'), fnc: 'ConfigCustom', permission: 'master'
|
|
52
|
-
{ reg: createSwitchRegExp('bilibili'), fnc: 'ConfigSwitch', permission: 'master'
|
|
53
|
-
{ reg: createNumberRegExp('bilibili'), fnc: 'ConfigNumber', permission: 'master'
|
|
54
|
-
{ reg: createNumberRegExp('bilibili'), fnc: 'ConfigCustom', permission: 'master'
|
|
55
|
-
{ reg: createSwitchRegExp('upload'), fnc: 'ConfigSwitch', permission: 'master'
|
|
56
|
-
{ reg: createNumberRegExp('upload'), fnc: 'ConfigNumber', permission: 'master'
|
|
57
|
-
{ reg: createNumberRegExp('upload'), fnc: 'ConfigCustom', permission: 'master'
|
|
58
|
-
{ reg: createSwitchRegExp('kuaishou'), fnc: 'ConfigSwitch', permission: 'master'
|
|
59
|
-
{ reg: createNumberRegExp('kuaishou'), fnc: 'ConfigNumber', permission: 'master'
|
|
60
|
-
{ reg: createNumberRegExp('kuaishou'), fnc: 'ConfigCustom', permission: 'master'
|
|
61
|
-
{ reg: /^#kkk设置$/, fnc: 'index_Settings', permission: 'master'
|
|
62
|
-
{ reg: /^#?kkk删除缓存$/, fnc: 'deleteCache', permission: 'master'
|
|
45
|
+
{ reg: createSwitchRegExp('app'), fnc: 'ConfigSwitch', permission: 'master' },
|
|
46
|
+
{ reg: createNumberRegExp('app'), fnc: 'ConfigNumber', permission: 'master' },
|
|
47
|
+
{ reg: createCustomRegExp('app'), fnc: 'ConfigCustom', permission: 'master' },
|
|
48
|
+
{ reg: createSwitchRegExp('douyin'), fnc: 'ConfigSwitch', permission: 'master' },
|
|
49
|
+
{ reg: createNumberRegExp('douyin'), fnc: 'ConfigNumber', permission: 'master' },
|
|
50
|
+
{ reg: createNumberRegExp('douyin'), fnc: 'ConfigCustom', permission: 'master' },
|
|
51
|
+
{ reg: createSwitchRegExp('bilibili'), fnc: 'ConfigSwitch', permission: 'master' },
|
|
52
|
+
{ reg: createNumberRegExp('bilibili'), fnc: 'ConfigNumber', permission: 'master' },
|
|
53
|
+
{ reg: createNumberRegExp('bilibili'), fnc: 'ConfigCustom', permission: 'master' },
|
|
54
|
+
{ reg: createSwitchRegExp('upload'), fnc: 'ConfigSwitch', permission: 'master' },
|
|
55
|
+
{ reg: createNumberRegExp('upload'), fnc: 'ConfigNumber', permission: 'master' },
|
|
56
|
+
{ reg: createNumberRegExp('upload'), fnc: 'ConfigCustom', permission: 'master' },
|
|
57
|
+
{ reg: createSwitchRegExp('kuaishou'), fnc: 'ConfigSwitch', permission: 'master' },
|
|
58
|
+
{ reg: createNumberRegExp('kuaishou'), fnc: 'ConfigNumber', permission: 'master' },
|
|
59
|
+
{ reg: createNumberRegExp('kuaishou'), fnc: 'ConfigCustom', permission: 'master' },
|
|
60
|
+
{ reg: /^#kkk设置$/, fnc: 'index_Settings', permission: 'master' },
|
|
61
|
+
{ reg: /^#?kkk删除缓存$/, fnc: 'deleteCache', permission: 'master' }
|
|
63
62
|
]
|
|
64
63
|
});
|
|
65
64
|
}
|
package/lib/cli/pr.js
CHANGED
|
@@ -22,7 +22,7 @@ const updateVersion = (pkg) => {
|
|
|
22
22
|
const list = pkg.version.split('.');
|
|
23
23
|
const shortHash = process.env.GITHUB_SHA?.substring(0, 7) ?? 'unknown';
|
|
24
24
|
list[2] = `${Number(list[2]) + 1}`;
|
|
25
|
-
pkg.version = `${list.join('.')}
|
|
25
|
+
pkg.version = `${list.join('.')}-pr${process.env.PR_NUMBER}.${shortHash}`;
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
28
|
* @description 设置环境变量
|
|
@@ -29,7 +29,7 @@ export declare class Networks {
|
|
|
29
29
|
getfetch(): Promise<AxiosResponse | boolean>;
|
|
30
30
|
returnResult(): Promise<AxiosResponse>;
|
|
31
31
|
/** 最终地址(跟随重定向) */
|
|
32
|
-
getLongLink(): Promise<string>;
|
|
32
|
+
getLongLink(url?: string): Promise<string>;
|
|
33
33
|
/** 获取首个302链接 */
|
|
34
34
|
getLocation(): Promise<AxiosResponse['headers']['location']>;
|
|
35
35
|
/** 获取数据并处理数据的格式化,默认json */
|
|
@@ -156,19 +156,20 @@ export class Networks {
|
|
|
156
156
|
return response;
|
|
157
157
|
}
|
|
158
158
|
/** 最终地址(跟随重定向) */
|
|
159
|
-
async getLongLink() {
|
|
159
|
+
async getLongLink(url = '') {
|
|
160
160
|
try {
|
|
161
|
-
const response = await this.axiosInstance(
|
|
162
|
-
|
|
163
|
-
url: this.url
|
|
164
|
-
});
|
|
165
|
-
return response.request.res.responseUrl; // axios中获取最终的请求URL
|
|
161
|
+
const response = await this.axiosInstance.get(this.url || url);
|
|
162
|
+
return response.request.res.responseUrl;
|
|
166
163
|
}
|
|
167
164
|
catch (error) {
|
|
168
|
-
|
|
169
|
-
|
|
165
|
+
const axiosError = error;
|
|
166
|
+
if (axiosError.response && axiosError.response.status === 302) {
|
|
167
|
+
// 获取重定向地址
|
|
168
|
+
const redirectUrl = axiosError.response.headers.location;
|
|
169
|
+
// 递归调用,直到获取最终地址
|
|
170
|
+
return this.getLongLink(redirectUrl);
|
|
170
171
|
}
|
|
171
|
-
|
|
172
|
+
throw error;
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
175
|
/** 获取首个302链接 */
|
|
@@ -26,7 +26,8 @@ export type dyVideo = {
|
|
|
26
26
|
export declare class DouYin extends Base {
|
|
27
27
|
e: Message;
|
|
28
28
|
type: DouyinDataTypes[keyof DouyinDataTypes];
|
|
29
|
-
is_mp4:
|
|
29
|
+
is_mp4: boolean | undefined;
|
|
30
|
+
is_slides: boolean;
|
|
30
31
|
get botadapter(): string;
|
|
31
32
|
constructor(e: Message, iddata: ExtendedDouyinOptionsType);
|
|
32
33
|
RESOURCES(data: any): Promise<true | undefined>;
|
|
@@ -11,6 +11,7 @@ export class DouYin extends Base {
|
|
|
11
11
|
e;
|
|
12
12
|
type;
|
|
13
13
|
is_mp4;
|
|
14
|
+
is_slides;
|
|
14
15
|
get botadapter() {
|
|
15
16
|
return this.e.bot?.adapter?.name;
|
|
16
17
|
}
|
|
@@ -19,46 +20,119 @@ export class DouYin extends Base {
|
|
|
19
20
|
this.e = e;
|
|
20
21
|
this.type = iddata?.type;
|
|
21
22
|
this.is_mp4 = iddata?.is_mp4;
|
|
23
|
+
this.is_slides = false;
|
|
22
24
|
}
|
|
23
25
|
async RESOURCES(data) {
|
|
24
26
|
switch (this.type) {
|
|
25
27
|
case 'one_work': {
|
|
26
28
|
if (Config.douyin.tip)
|
|
27
29
|
this.e.reply('检测到抖音链接,开始解析');
|
|
30
|
+
this.is_slides = data.VideoData.aweme_detail.is_slides === true;
|
|
28
31
|
let g_video_url = '';
|
|
29
32
|
let g_title;
|
|
30
|
-
const full_data = [];
|
|
31
33
|
/** 图集 */
|
|
32
34
|
let imagenum = 0;
|
|
33
35
|
const image_res = [];
|
|
34
36
|
if (this.is_mp4 === false) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
switch (true) {
|
|
38
|
+
// 图集
|
|
39
|
+
case this.is_slides === false: {
|
|
40
|
+
const image_data = [];
|
|
41
|
+
const imageres = [];
|
|
42
|
+
let image_url;
|
|
43
|
+
for (let i = 0; i < data.VideoData.aweme_detail.images.length; i++) {
|
|
44
|
+
image_url = data.VideoData.aweme_detail.images[i].url_list[2] || data.VideoData.aweme_detail.images[i].url_list[1]; // 图片地址
|
|
45
|
+
const title = data.VideoData.aweme_detail.preview_title.substring(0, 50).replace(/[\\/:\*\?"<>\|\r\n]/g, ' '); // 标题,去除特殊字符
|
|
46
|
+
g_title = title;
|
|
47
|
+
imageres.push(segment.image(image_url));
|
|
48
|
+
imagenum++;
|
|
49
|
+
if (Config.app.rmmp4 === false) {
|
|
50
|
+
mkdirSync(`${Common.tempDri.images}${g_title}`);
|
|
51
|
+
const path = `${Common.tempDri.images}${g_title}/${i + 1}.png`;
|
|
52
|
+
await new Networks({ url: image_url, type: 'arraybuffer' }).getData().then((data) => fs.promises.writeFile(path, Buffer.from(data)));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const res = common.makeForward(imageres, this.e.sender.userId, this.e.sender.nick);
|
|
56
|
+
image_data.push(res);
|
|
57
|
+
image_res.push(image_data);
|
|
58
|
+
if (imageres.length === 1) {
|
|
59
|
+
await this.e.reply(segment.image(image_url));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
await this.e.bot.sendForwardMsg(this.e.contact, res, {
|
|
63
|
+
source: '图片合集',
|
|
64
|
+
summary: `查看${res.length}张图片消息`,
|
|
65
|
+
prompt: '抖音图集解析结果',
|
|
66
|
+
news: [{ text: '点击查看解析结果' }]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
// 合辑
|
|
72
|
+
case data.VideoData.aweme_detail.is_slides === true: {
|
|
73
|
+
const images = [];
|
|
74
|
+
const temp = [];
|
|
75
|
+
/** BGM */
|
|
76
|
+
const liveimgbgm = await this.DownLoadFile(data.VideoData.aweme_detail.music.play_url.uri, {
|
|
77
|
+
title: `Douyin_tmp_A_${Date.now()}.mp3`,
|
|
78
|
+
headers: this.headers
|
|
79
|
+
});
|
|
80
|
+
temp.push(liveimgbgm);
|
|
81
|
+
for (const item of data.VideoData.aweme_detail.images) {
|
|
82
|
+
imagenum++;
|
|
83
|
+
// 静态图片,clip_type为2
|
|
84
|
+
if (item.clip_type === 2) {
|
|
85
|
+
images.push(segment.image((item.url_list[0])));
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
/** 动图 */
|
|
89
|
+
const liveimg = await this.DownLoadFile(`https://aweme.snssdk.com/aweme/v1/play/?video_id=${item.video.play_addr_h264.uri}&ratio=1080p&line=0`, {
|
|
90
|
+
title: `Douyin_tmp_V_${Date.now()}.mp4`,
|
|
91
|
+
headers: this.headers
|
|
92
|
+
});
|
|
93
|
+
if (liveimg.filepath) {
|
|
94
|
+
const resolvefilepath = Common.tempDri.video + `Douyin_Result_${Date.now()}.mp4`;
|
|
95
|
+
await mergeFile('视频*3 + 音频', {
|
|
96
|
+
path: liveimg.filepath,
|
|
97
|
+
path2: liveimgbgm.filepath,
|
|
98
|
+
resultPath: resolvefilepath,
|
|
99
|
+
callback: async (success, resultPath) => {
|
|
100
|
+
if (success) {
|
|
101
|
+
const filePath = Common.tempDri.video + `tmp_${Date.now()}.mp4`;
|
|
102
|
+
fs.renameSync(resultPath, filePath);
|
|
103
|
+
await this.removeFile(liveimg.filepath, true);
|
|
104
|
+
temp.push({ filepath: filePath, totalBytes: 0 });
|
|
105
|
+
images.push(segment.video('file://' + filePath));
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
await this.removeFile(liveimg.filepath, true);
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const Element = common.makeForward(images, this.e.sender.userId, this.e.sender.nick);
|
|
117
|
+
try {
|
|
118
|
+
await this.e.bot.sendForwardMsg(this.e.contact, Element, {
|
|
119
|
+
source: '合辑内容',
|
|
120
|
+
summary: `查看${Element.length}张图片/视频消息`,
|
|
121
|
+
prompt: '抖音合辑解析结果',
|
|
122
|
+
news: [{ text: '点击查看解析结果' }]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
await this.e.reply(JSON.stringify(error, null, 2));
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
for (const item of temp) {
|
|
130
|
+
await this.removeFile(item.filepath, true);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
break;
|
|
48
134
|
}
|
|
49
135
|
}
|
|
50
|
-
const res = common.makeForward(imageres, this.e.sender.userId, this.e.sender.nick);
|
|
51
|
-
image_data.push(res);
|
|
52
|
-
image_res.push(image_data);
|
|
53
|
-
if (imageres.length === 1) {
|
|
54
|
-
await this.e.reply(segment.image(image_url));
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
await this.e.bot.sendForwardMsg(this.e.contact, res);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
image_res.push('图集信息解析失败');
|
|
62
136
|
}
|
|
63
137
|
/** 背景音乐 */
|
|
64
138
|
if (data.VideoData.aweme_detail.music) {
|
|
@@ -118,7 +192,7 @@ export class DouYin extends Base {
|
|
|
118
192
|
const list = await Emoji(EmojiData);
|
|
119
193
|
const commentsArray = await douyinComments(data.CommentsData, list);
|
|
120
194
|
const img = await Render('douyin/comment', {
|
|
121
|
-
Type: this.is_mp4 ? '视频' : '图集',
|
|
195
|
+
Type: this.is_mp4 ? '视频' : this.is_slides ? '合辑' : '图集',
|
|
122
196
|
CommentsData: commentsArray,
|
|
123
197
|
CommentLength: String(commentsArray.jsonArray?.length ? commentsArray.jsonArray.length : 0),
|
|
124
198
|
share_url: this.is_mp4
|
|
@@ -135,75 +209,6 @@ export class DouYin extends Base {
|
|
|
135
209
|
sendvideofile && this.is_mp4 && await this.DownLoadVideo({ video_url: g_video_url, title: { timestampTitle: `tmp_${Date.now()}.mp4`, originTitle: `${g_title}.mp4` } });
|
|
136
210
|
return true;
|
|
137
211
|
}
|
|
138
|
-
case 'user_mix_videos': {
|
|
139
|
-
const emojiData = await getDouyinData('Emoji数据');
|
|
140
|
-
const commentsData = await douyinComments(data.CommentsData, Emoji(emojiData));
|
|
141
|
-
const commentImage = await Render('douyin/comment', {
|
|
142
|
-
Type: '合辑作品',
|
|
143
|
-
CommentsData: commentsData,
|
|
144
|
-
CommentLength: String(commentsData.jsonArray?.length ? commentsData.jsonArray.length : 0),
|
|
145
|
-
share_url: data.LiveImageData.aweme_details[0].share_url,
|
|
146
|
-
VideoSize: '???',
|
|
147
|
-
VideoFPS: '???',
|
|
148
|
-
ImageLength: '???'
|
|
149
|
-
});
|
|
150
|
-
await this.e.reply(commentImage);
|
|
151
|
-
const images = [];
|
|
152
|
-
const temp = [];
|
|
153
|
-
/** BGM */
|
|
154
|
-
const liveimgbgm = await this.DownLoadFile(data.LiveImageData.aweme_details[0].music.play_url.uri, {
|
|
155
|
-
title: `Douyin_tmp_A_${Date.now()}.mp3`,
|
|
156
|
-
headers: this.headers
|
|
157
|
-
});
|
|
158
|
-
temp.push(liveimgbgm);
|
|
159
|
-
for (const item of data.LiveImageData.aweme_details[0].images) {
|
|
160
|
-
// 静态图片,clip_type为2
|
|
161
|
-
if (item.clip_type === 2) {
|
|
162
|
-
images.push(segment.image((item.url_list[0])));
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
/** 动图 */
|
|
166
|
-
const liveimg = await this.DownLoadFile(`https://aweme.snssdk.com/aweme/v1/play/?video_id=${item.video.play_addr_h264.uri}&ratio=1080p&line=0`, {
|
|
167
|
-
title: `Douyin_tmp_V_${Date.now()}.mp4`,
|
|
168
|
-
headers: this.headers
|
|
169
|
-
});
|
|
170
|
-
if (liveimg.filepath) {
|
|
171
|
-
const resolvefilepath = Common.tempDri.video + `Douyin_Result_${Date.now()}.mp4`;
|
|
172
|
-
await mergeFile('视频*3 + 音频', {
|
|
173
|
-
path: liveimg.filepath,
|
|
174
|
-
path2: liveimgbgm.filepath,
|
|
175
|
-
resultPath: resolvefilepath,
|
|
176
|
-
callback: async (success, resultPath) => {
|
|
177
|
-
if (success) {
|
|
178
|
-
const filePath = Common.tempDri.video + `tmp_${Date.now()}.mp4`;
|
|
179
|
-
fs.renameSync(resultPath, filePath);
|
|
180
|
-
await this.removeFile(liveimg.filepath, true);
|
|
181
|
-
temp.push({ filepath: filePath, totalBytes: 0 });
|
|
182
|
-
images.push(segment.video('file://' + filePath));
|
|
183
|
-
return true;
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
await this.removeFile(liveimg.filepath, true);
|
|
187
|
-
return true;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
const Element = common.makeForward(images, this.e.sender.userId, this.e.sender.nick);
|
|
194
|
-
try {
|
|
195
|
-
await this.e.bot.sendForwardMsg(this.e.contact, Element);
|
|
196
|
-
}
|
|
197
|
-
catch (error) {
|
|
198
|
-
await this.e.reply(JSON.stringify(error, null, 2));
|
|
199
|
-
}
|
|
200
|
-
finally {
|
|
201
|
-
for (const item of temp) {
|
|
202
|
-
await this.removeFile(item.filepath, true);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
212
|
case 'user_dynamic': {
|
|
208
213
|
const veoarray = [];
|
|
209
214
|
veoarray.unshift('------------------------------ | ---------------------------- |\n');
|
|
@@ -241,6 +246,10 @@ export class DouYin extends Base {
|
|
|
241
246
|
}
|
|
242
247
|
const search_data = new_userdata;
|
|
243
248
|
}
|
|
249
|
+
if (!data.music_info.play_url) {
|
|
250
|
+
await this.e.reply('解析错误!该音乐抖音未提供下载链接,无法下载', { reply: true });
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
244
253
|
img = await Render('douyin/musicinfo', {
|
|
245
254
|
image_url: data.music_info.cover_hd.url_list[0],
|
|
246
255
|
desc: data.music_info.title,
|
|
@@ -7,19 +7,14 @@ import { Networks } from '../../module/utils/index.js';
|
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
9
|
export async function getDouyinID(url, log = true) {
|
|
10
|
-
const longLink = await new Networks({
|
|
10
|
+
const longLink = await new Networks({
|
|
11
|
+
url,
|
|
12
|
+
headers: {
|
|
13
|
+
'User-Agent': 'Apifox/1.0.0 (https://apifox.com)'
|
|
14
|
+
}
|
|
15
|
+
}).getLongLink();
|
|
11
16
|
let result = {};
|
|
12
17
|
switch (true) {
|
|
13
|
-
case /https:\/\/(?:www\.iesdouyin\.com)\/share\/slides/.test(longLink):
|
|
14
|
-
case longLink === 'https://www.douyin.com/': {
|
|
15
|
-
const match = longLink.match(/share\/slides\/(\d+)/);
|
|
16
|
-
result = {
|
|
17
|
-
type: 'user_mix_videos',
|
|
18
|
-
aweme_id: match ? match[1] : undefined,
|
|
19
|
-
is_mp4: false
|
|
20
|
-
};
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
18
|
case longLink.includes('webcast.amemv.com'):
|
|
24
19
|
case longLink.includes('live.douyin.com'): {
|
|
25
20
|
if (longLink.includes('webcast.amemv.com')) {
|
|
@@ -130,7 +130,7 @@ export class DouYinpush extends Base {
|
|
|
130
130
|
else if (!iddata.is_mp4 && iddata.type === 'one_work') { // 如果新作品是图集
|
|
131
131
|
const imageres = [];
|
|
132
132
|
let image_url;
|
|
133
|
-
for (const item of Detail_Data.
|
|
133
|
+
for (const item of Detail_Data.images) {
|
|
134
134
|
image_url = item.url_list[2] || item.url_list[1]; // 图片地址
|
|
135
135
|
imageres.push(segment.image(image_url));
|
|
136
136
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "karin-plugin-kkk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8-pr32.022e593",
|
|
4
4
|
"description": "a Karin video parsing tool",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"karin-plugin",
|
|
@@ -36,18 +36,9 @@
|
|
|
36
36
|
"pub": "npm publish --access public",
|
|
37
37
|
"pub-beta": "npm publish --tag beta",
|
|
38
38
|
"sort": "npx sort-package-json",
|
|
39
|
-
"karin": "karin",
|
|
40
|
-
"app": "karin app",
|
|
41
39
|
"start": "karin start",
|
|
42
|
-
"pm2": "karin pm2",
|
|
43
|
-
"stop": "karin stop",
|
|
44
|
-
"rs": "karin rs",
|
|
45
|
-
"log": "karin log",
|
|
46
|
-
"up": "karin up",
|
|
47
40
|
"init": "karin init",
|
|
48
|
-
"dev": "tsx watch --include \"src/**/*.ts\" src/index.ts"
|
|
49
|
-
"ts": "karin ts",
|
|
50
|
-
"watch": "karin watch"
|
|
41
|
+
"dev": "tsx watch --include \"src/**/*.ts\" src/index.ts"
|
|
51
42
|
},
|
|
52
43
|
"dependencies": {
|
|
53
44
|
"@ikenxuan/amagi": "4.2.5",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
{{if Type == '视频'}}
|
|
13
13
|
<div class="top-info">视频大小:{{VideoSize}}MB</div>
|
|
14
14
|
<div class="top-info">视频帧率:{{VideoFPS}}Hz</div>
|
|
15
|
-
{{else if Type == '图集'}}
|
|
15
|
+
{{else if Type == '图集' || Type == '合辑'}}
|
|
16
16
|
<div class="top-info">图片数量:{{ImageLength}}张</div>
|
|
17
17
|
{{/if}}
|
|
18
18
|
</div>
|