karin-plugin-kkk 2.18.3 → 2.19.0
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 +24 -0
- package/README.md +1 -1
- package/config/default_config/pushlist.yaml +8 -0
- package/lib/apps/admin.js +3 -3
- package/lib/apps/help.js +3 -3
- package/lib/apps/push.js +3 -3
- package/lib/apps/qrlogin.js +3 -3
- package/lib/apps/tools.js +3 -3
- package/lib/apps/update.js +3 -3
- package/lib/build-metadata.json +5 -5
- package/lib/core_chunk/{main-DFGREgML.js → main-Dj5f-cmP.js} +913 -136
- package/lib/core_chunk/{template-BBVRQ9ag.js → template-CHNHRIxO.js} +1064 -496
- package/lib/core_chunk/template.d.mts +65 -4
- package/lib/core_chunk/template.js +2 -2
- package/lib/core_chunk/{vendor-B-twx8Ds.js → vendor-BsdYKPEs.js} +434 -309
- package/lib/index.js +3 -3
- package/lib/karin-plugin-kkk.css +497 -11
- package/lib/root.js +1 -1
- package/lib/web.config.js +3 -3
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __esmMin, o as __toESM, r as __export } from "./rolldown-runtime-BMXAG3ag.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as init_client, r as reactServerRender } from "./template-
|
|
2
|
+
import { D as init_locale, O as zhCN, _n as init_zod, a as require_lib, at as format, c as Window, cn as require_express, dn as init_source, fn as AxiosError$1, gn as init_esm, hn as Xhshow, i as require_dist, it as formatDistanceToNow, ln as require_protobufjs, mn as axios_default, n as require_jsQR, nt as init_date_fns, o as require_qr_code_styling, ot as differenceInSeconds, pn as init_axios, r as require_heic_convert, rt as fromUnixTime, s as init_lib, t as require_png, un as Chalk, vn as zod_default } from "./vendor-BsdYKPEs.js";
|
|
3
|
+
import { n as init_client, r as reactServerRender } from "./template-CHNHRIxO.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import karin$1, { BOT_CONNECT, app, authMiddleware, checkPkgUpdate, checkPort, common, components, config, copyConfigSync, createBadRequestResponse, createNotFoundResponse, createServerErrorResponse, createSuccessResponse, db, defineConfig, ffmpeg, ffprobe, filesByExt, getBot, hooks, karin, karinPathHtml, karinPathTemp, logger, logs, mkdirSync, range, render, requireFileSync, restart, segment, updatePkg, watch } from "node-karin";
|
|
6
6
|
import fs from "node:fs";
|
|
@@ -746,7 +746,7 @@ var init_bilibili$3 = __esmMin(() => {
|
|
|
746
746
|
videoDanmaku: "/fetch_danmaku"
|
|
747
747
|
};
|
|
748
748
|
});
|
|
749
|
-
var DouyinWorkParamsSchema, DouyinCommentParamsSchema, DouyinHotWordsParamsSchema, DouyinSearchParamsSchema, DouyinCommentReplyParamsSchema, DouyinUserParamsSchema, DouyinMusicParamsSchema, DouyinLiveRoomParamsSchema, DouyinQrcodeParamsSchema, DouyinEmojiListParamsSchema, DouyinEmojiProParamsSchema, DouyinDanmakuParamsSchema, DouyinValidationSchemas, DouyinMethodRoutes;
|
|
749
|
+
var DouyinWorkParamsSchema, DouyinCommentParamsSchema, DouyinHotWordsParamsSchema, DouyinSearchParamsSchema, DouyinCommentReplyParamsSchema, DouyinUserParamsSchema, DouyinUserListParamsSchema, DouyinMusicParamsSchema, DouyinLiveRoomParamsSchema, DouyinQrcodeParamsSchema, DouyinEmojiListParamsSchema, DouyinEmojiProParamsSchema, DouyinDanmakuParamsSchema, DouyinValidationSchemas, DouyinMethodRoutes;
|
|
750
750
|
var init_douyin$3 = __esmMin(() => {
|
|
751
751
|
init_zod();
|
|
752
752
|
init_utils$3();
|
|
@@ -789,9 +789,19 @@ var init_douyin$3 = __esmMin(() => {
|
|
|
789
789
|
cursor: zod_default.coerce.number({ error: "游标必须是数字" }).int({ error: "游标必须是整数" }).min(0, { error: "游标不能小于0" }).default(0).optional()
|
|
790
790
|
});
|
|
791
791
|
DouyinUserParamsSchema = zod_default.object({
|
|
792
|
-
methodType: zod_default.
|
|
792
|
+
methodType: zod_default.literal("userProfile", { error: "方法类型必须是\"userProfile\"" }),
|
|
793
793
|
sec_uid: zod_default.string({ error: "用户ID必须是字符串" }).min(1, { error: "用户ID不能为空" })
|
|
794
794
|
});
|
|
795
|
+
DouyinUserListParamsSchema = zod_default.object({
|
|
796
|
+
methodType: zod_default.enum([
|
|
797
|
+
"userVideoList",
|
|
798
|
+
"userFavoriteList",
|
|
799
|
+
"userRecommendList"
|
|
800
|
+
], { error: "方法类型必须是指定的枚举值之一" }),
|
|
801
|
+
sec_uid: zod_default.string({ error: "用户ID必须是字符串" }).min(1, { error: "用户ID不能为空" }),
|
|
802
|
+
number: smartPositiveInteger("获取数量必须是正整数").optional().default(18),
|
|
803
|
+
max_cursor: zod_default.string({ error: "游标必须是字符串" }).optional()
|
|
804
|
+
});
|
|
795
805
|
DouyinMusicParamsSchema = zod_default.object({
|
|
796
806
|
methodType: zod_default.literal("musicInfo", { error: "方法类型必须是\"musicInfo\"" }),
|
|
797
807
|
music_id: zod_default.string({ error: "音乐ID必须是字符串" }).min(1, { error: "音乐ID不能为空" })
|
|
@@ -834,7 +844,9 @@ var init_douyin$3 = __esmMin(() => {
|
|
|
834
844
|
slidesWork: DouyinWorkParamsSchema,
|
|
835
845
|
comments: DouyinCommentParamsSchema,
|
|
836
846
|
userProfile: DouyinUserParamsSchema,
|
|
837
|
-
userVideoList:
|
|
847
|
+
userVideoList: DouyinUserListParamsSchema,
|
|
848
|
+
userFavoriteList: DouyinUserListParamsSchema,
|
|
849
|
+
userRecommendList: DouyinUserListParamsSchema,
|
|
838
850
|
suggestWords: DouyinHotWordsParamsSchema,
|
|
839
851
|
search: DouyinSearchParamsSchema,
|
|
840
852
|
musicInfo: DouyinMusicParamsSchema,
|
|
@@ -855,6 +867,8 @@ var init_douyin$3 = __esmMin(() => {
|
|
|
855
867
|
commentReplies: "/fetch_video_comment_replies",
|
|
856
868
|
userProfile: "/fetch_user_info",
|
|
857
869
|
userVideoList: "/fetch_user_post_videos",
|
|
870
|
+
userFavoriteList: "/fetch_user_favorite_list",
|
|
871
|
+
userRecommendList: "/fetch_user_recommend_list",
|
|
858
872
|
search: "/fetch_search_info",
|
|
859
873
|
suggestWords: "/fetch_suggest_words",
|
|
860
874
|
musicInfo: "/fetch_music_work",
|
|
@@ -2354,14 +2368,14 @@ var init_API$1 = __esmMin(() => {
|
|
|
2354
2368
|
return `https://www.douyin.com/aweme/v1/web/aweme/post/?${buildQueryString({
|
|
2355
2369
|
...this.getBaseParams(),
|
|
2356
2370
|
sec_user_id: data$1.sec_uid,
|
|
2357
|
-
max_cursor: "0",
|
|
2371
|
+
max_cursor: data$1.max_cursor ?? "0",
|
|
2358
2372
|
locate_query: "false",
|
|
2359
2373
|
show_live_replay_strategy: "1",
|
|
2360
2374
|
need_time_list: "1",
|
|
2361
2375
|
time_list_query: "0",
|
|
2362
2376
|
whale_cut_token: "",
|
|
2363
2377
|
cut_version: "1",
|
|
2364
|
-
count:
|
|
2378
|
+
count: data$1.number ?? 18,
|
|
2365
2379
|
publish_video_strategy_type: "2",
|
|
2366
2380
|
version_code: "170400",
|
|
2367
2381
|
version_name: "17.4.0",
|
|
@@ -2371,6 +2385,70 @@ var init_API$1 = __esmMin(() => {
|
|
|
2371
2385
|
webid: "7338423850134226495"
|
|
2372
2386
|
})}`;
|
|
2373
2387
|
}
|
|
2388
|
+
getUserFavoriteList(data$1) {
|
|
2389
|
+
return `https://www-hj.douyin.com/aweme/v1/web/aweme/favorite/?${buildQueryString({
|
|
2390
|
+
...this.getBaseParams(),
|
|
2391
|
+
sec_user_id: data$1.sec_uid,
|
|
2392
|
+
max_cursor: data$1.max_cursor ?? "0",
|
|
2393
|
+
min_cursor: "0",
|
|
2394
|
+
whale_cut_token: "",
|
|
2395
|
+
cut_version: "1",
|
|
2396
|
+
count: data$1.number ?? 18,
|
|
2397
|
+
publish_video_strategy_type: "2",
|
|
2398
|
+
update_version_code: "170400",
|
|
2399
|
+
pc_libra_divert: "Windows",
|
|
2400
|
+
support_h265: "1",
|
|
2401
|
+
support_dash: "1",
|
|
2402
|
+
version_code: "170400",
|
|
2403
|
+
version_name: "17.4.0",
|
|
2404
|
+
screen_width: "2328",
|
|
2405
|
+
screen_height: "1310",
|
|
2406
|
+
round_trip_time: "0",
|
|
2407
|
+
webid: "7487210762873685515"
|
|
2408
|
+
})}`;
|
|
2409
|
+
}
|
|
2410
|
+
getUserRecommendList(data$1) {
|
|
2411
|
+
return `https://www.douyin.com/aweme/v1/web/familiar/recommend/feed/?${buildQueryString({
|
|
2412
|
+
device_platform: "",
|
|
2413
|
+
aid: "6383",
|
|
2414
|
+
channel: "channel_pc_web",
|
|
2415
|
+
sec_user_id: data$1.sec_uid,
|
|
2416
|
+
max_cursor: data$1.max_cursor ?? "0",
|
|
2417
|
+
min_cursor: "0",
|
|
2418
|
+
whale_cut_token: "",
|
|
2419
|
+
count: data$1.number ?? 18,
|
|
2420
|
+
from: "1",
|
|
2421
|
+
update_version_code: "170400",
|
|
2422
|
+
pc_client_type: "1",
|
|
2423
|
+
pc_libra_divert: "Windows",
|
|
2424
|
+
support_h265: "1",
|
|
2425
|
+
support_dash: "1",
|
|
2426
|
+
cpu_core_num: "16",
|
|
2427
|
+
version_code: "170400",
|
|
2428
|
+
version_name: "17.4.0",
|
|
2429
|
+
cookie_enabled: "true",
|
|
2430
|
+
screen_width: "2328",
|
|
2431
|
+
screen_height: "1310",
|
|
2432
|
+
browser_language: "zh-CN",
|
|
2433
|
+
browser_platform: "Win32",
|
|
2434
|
+
browser_name: "Edge",
|
|
2435
|
+
browser_version: this.browserVersion,
|
|
2436
|
+
browser_online: "true",
|
|
2437
|
+
engine_name: "Blink",
|
|
2438
|
+
engine_version: this.browserVersion,
|
|
2439
|
+
os_name: "Windows",
|
|
2440
|
+
os_version: "10",
|
|
2441
|
+
device_memory: "8",
|
|
2442
|
+
platform: "PC",
|
|
2443
|
+
downlink: "10",
|
|
2444
|
+
effective_type: "4g",
|
|
2445
|
+
round_trip_time: "50",
|
|
2446
|
+
webid: "7487210762873685515",
|
|
2447
|
+
msToken: douyinSign.Mstoken(184),
|
|
2448
|
+
verifyFp: fp,
|
|
2449
|
+
fp
|
|
2450
|
+
})}`;
|
|
2451
|
+
}
|
|
2374
2452
|
getUserProfile(data$1) {
|
|
2375
2453
|
return `https://www.douyin.com/aweme/v1/web/user/profile/other/?${buildQueryString({
|
|
2376
2454
|
...this.getBaseParams(),
|
|
@@ -2737,17 +2815,93 @@ var init_getdata$3 = __esmMin(() => {
|
|
|
2737
2815
|
});
|
|
2738
2816
|
}
|
|
2739
2817
|
case "userVideoList": {
|
|
2740
|
-
const
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
...
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2818
|
+
const urlGenerator = (params) => douyinApiUrls$1.getUserVideoList(params);
|
|
2819
|
+
return await fetchPaginatedData({
|
|
2820
|
+
type: data$1.methodType,
|
|
2821
|
+
apiUrlGenerator: urlGenerator,
|
|
2822
|
+
params: {
|
|
2823
|
+
...data$1,
|
|
2824
|
+
max_cursor: data$1.max_cursor
|
|
2825
|
+
},
|
|
2826
|
+
maxPageSize: 18,
|
|
2827
|
+
requestConfig: {
|
|
2828
|
+
...baseRequestConfig,
|
|
2829
|
+
headers: {
|
|
2830
|
+
...baseRequestConfig.headers,
|
|
2831
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data$1.sec_uid}` }
|
|
2832
|
+
}
|
|
2833
|
+
},
|
|
2834
|
+
signType,
|
|
2835
|
+
extractList: (resp) => resp.aweme_list ?? [],
|
|
2836
|
+
updateParams: (params, resp) => ({
|
|
2837
|
+
...params,
|
|
2838
|
+
max_cursor: resp.max_cursor?.toString() ?? "0"
|
|
2839
|
+
}),
|
|
2840
|
+
hasMore: (resp) => resp.has_more === 1,
|
|
2841
|
+
formatFinalResponse: (resp, list) => ({
|
|
2842
|
+
...resp,
|
|
2843
|
+
aweme_list: list
|
|
2844
|
+
})
|
|
2845
|
+
});
|
|
2846
|
+
}
|
|
2847
|
+
case "userFavoriteList": {
|
|
2848
|
+
const urlGenerator = (params) => douyinApiUrls$1.getUserFavoriteList(params);
|
|
2849
|
+
return await fetchPaginatedData({
|
|
2850
|
+
type: data$1.methodType,
|
|
2851
|
+
apiUrlGenerator: urlGenerator,
|
|
2852
|
+
params: {
|
|
2853
|
+
...data$1,
|
|
2854
|
+
max_cursor: data$1.max_cursor
|
|
2855
|
+
},
|
|
2856
|
+
maxPageSize: 18,
|
|
2857
|
+
requestConfig: {
|
|
2858
|
+
...baseRequestConfig,
|
|
2859
|
+
headers: {
|
|
2860
|
+
...baseRequestConfig.headers,
|
|
2861
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data$1.sec_uid}` }
|
|
2862
|
+
}
|
|
2863
|
+
},
|
|
2864
|
+
signType,
|
|
2865
|
+
extractList: (resp) => resp.aweme_list ?? [],
|
|
2866
|
+
updateParams: (params, resp) => ({
|
|
2867
|
+
...params,
|
|
2868
|
+
max_cursor: resp.max_cursor?.toString() ?? "0"
|
|
2869
|
+
}),
|
|
2870
|
+
hasMore: (resp) => resp.has_more === 1,
|
|
2871
|
+
formatFinalResponse: (resp, list) => ({
|
|
2872
|
+
...resp,
|
|
2873
|
+
aweme_list: list
|
|
2874
|
+
})
|
|
2875
|
+
});
|
|
2876
|
+
}
|
|
2877
|
+
case "userRecommendList": {
|
|
2878
|
+
const urlGenerator = (params) => douyinApiUrls$1.getUserRecommendList(params);
|
|
2879
|
+
return await fetchPaginatedData({
|
|
2880
|
+
type: data$1.methodType,
|
|
2881
|
+
apiUrlGenerator: urlGenerator,
|
|
2882
|
+
params: {
|
|
2883
|
+
...data$1,
|
|
2884
|
+
max_cursor: data$1.max_cursor
|
|
2885
|
+
},
|
|
2886
|
+
maxPageSize: 18,
|
|
2887
|
+
requestConfig: {
|
|
2888
|
+
...baseRequestConfig,
|
|
2889
|
+
headers: {
|
|
2890
|
+
...baseRequestConfig.headers,
|
|
2891
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data$1.sec_uid}` }
|
|
2892
|
+
}
|
|
2893
|
+
},
|
|
2894
|
+
signType,
|
|
2895
|
+
extractList: (resp) => resp.aweme_list ?? [],
|
|
2896
|
+
updateParams: (params, resp) => ({
|
|
2897
|
+
...params,
|
|
2898
|
+
max_cursor: resp.max_cursor?.toString() ?? "0"
|
|
2899
|
+
}),
|
|
2900
|
+
hasMore: (resp) => resp.has_more === 1,
|
|
2901
|
+
formatFinalResponse: (resp, list) => ({
|
|
2902
|
+
...resp,
|
|
2903
|
+
aweme_list: list
|
|
2904
|
+
})
|
|
2751
2905
|
});
|
|
2752
2906
|
}
|
|
2753
2907
|
case "suggestWords": {
|
|
@@ -3240,6 +3394,18 @@ async function fetchUserVideoList(options, cookie, requestConfig) {
|
|
|
3240
3394
|
requestConfig
|
|
3241
3395
|
});
|
|
3242
3396
|
}
|
|
3397
|
+
async function fetchUserFavoriteList(options, cookie, requestConfig) {
|
|
3398
|
+
return fetchDouyinInternal("userFavoriteList", options, {
|
|
3399
|
+
cookie,
|
|
3400
|
+
requestConfig
|
|
3401
|
+
});
|
|
3402
|
+
}
|
|
3403
|
+
async function fetchUserRecommendList(options, cookie, requestConfig) {
|
|
3404
|
+
return fetchDouyinInternal("userRecommendList", options, {
|
|
3405
|
+
cookie,
|
|
3406
|
+
requestConfig
|
|
3407
|
+
});
|
|
3408
|
+
}
|
|
3243
3409
|
var init_user$1 = __esmMin(() => {
|
|
3244
3410
|
init_internal$2();
|
|
3245
3411
|
});
|
|
@@ -3294,6 +3460,8 @@ function createBoundDouyinFetcher(cookie, requestConfig) {
|
|
|
3294
3460
|
fetchCommentReplies: (options, reqConfig) => fetchCommentReplies(options, cookie, reqConfig ?? requestConfig),
|
|
3295
3461
|
fetchUserProfile: (options, reqConfig) => fetchUserProfile$1(options, cookie, reqConfig ?? requestConfig),
|
|
3296
3462
|
fetchUserVideoList: (options, reqConfig) => fetchUserVideoList(options, cookie, reqConfig ?? requestConfig),
|
|
3463
|
+
fetchUserFavoriteList: (options, reqConfig) => fetchUserFavoriteList(options, cookie, reqConfig ?? requestConfig),
|
|
3464
|
+
fetchUserRecommendList: (options, reqConfig) => fetchUserRecommendList(options, cookie, reqConfig ?? requestConfig),
|
|
3297
3465
|
searchContent: (options, reqConfig) => searchContent(options, cookie, reqConfig ?? requestConfig),
|
|
3298
3466
|
fetchSuggestWords: (options, reqConfig) => fetchSuggestWords(options, cookie, reqConfig ?? requestConfig),
|
|
3299
3467
|
fetchMusicInfo: (options, reqConfig) => fetchMusicInfo(options, cookie, reqConfig ?? requestConfig),
|
|
@@ -3334,6 +3502,8 @@ var init_douyin$2 = __esmMin(() => {
|
|
|
3334
3502
|
fetchCommentReplies,
|
|
3335
3503
|
fetchUserProfile: fetchUserProfile$1,
|
|
3336
3504
|
fetchUserVideoList,
|
|
3505
|
+
fetchUserFavoriteList,
|
|
3506
|
+
fetchUserRecommendList,
|
|
3337
3507
|
searchContent,
|
|
3338
3508
|
fetchSuggestWords,
|
|
3339
3509
|
fetchMusicInfo,
|
|
@@ -8399,6 +8569,7 @@ var init_douyin = __esmMin(async () => {
|
|
|
8399
8569
|
await fs.promises.mkdir(path.dirname(this.dbPath), { recursive: true });
|
|
8400
8570
|
this.db = new sqlite3.Database(this.dbPath);
|
|
8401
8571
|
await this.createTables();
|
|
8572
|
+
await this.migrate();
|
|
8402
8573
|
logger.debug("[DouyinDB] 数据库模型同步成功");
|
|
8403
8574
|
logger.debug("[DouyinDB] 正在同步配置订阅...");
|
|
8404
8575
|
logger.debug("[DouyinDB] 配置项数量:", Config.pushlist.douyin?.length || 0);
|
|
@@ -8411,15 +8582,33 @@ var init_douyin = __esmMin(async () => {
|
|
|
8411
8582
|
}
|
|
8412
8583
|
return this;
|
|
8413
8584
|
}
|
|
8585
|
+
async migrate() {
|
|
8586
|
+
try {
|
|
8587
|
+
try {
|
|
8588
|
+
await this.runQuery("SELECT pushType FROM AwemeCaches LIMIT 1");
|
|
8589
|
+
} catch {
|
|
8590
|
+
logger.info("[DouyinDB] 检测到 AwemeCaches 表缺少 pushType 字段,开始执行迁移...");
|
|
8591
|
+
await this.runQuery("ALTER TABLE AwemeCaches ADD COLUMN pushType TEXT DEFAULT 'post'");
|
|
8592
|
+
await this.runQuery("ALTER TABLE AwemeCaches RENAME TO AwemeCaches_old");
|
|
8593
|
+
await this.runQuery(`\n CREATE TABLE IF NOT EXISTS AwemeCaches (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n aweme_id TEXT NOT NULL,\n sec_uid TEXT NOT NULL,\n groupId TEXT NOT NULL,\n pushType TEXT DEFAULT 'post',\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (sec_uid) REFERENCES DouyinUsers(sec_uid),\n FOREIGN KEY (groupId) REFERENCES Groups(id),\n UNIQUE(aweme_id, sec_uid, groupId, pushType)\n )\n `);
|
|
8594
|
+
await this.runQuery(`\n INSERT INTO AwemeCaches (id, aweme_id, sec_uid, groupId, pushType, createdAt, updatedAt)\n SELECT id, aweme_id, sec_uid, groupId, pushType, createdAt, updatedAt\n FROM AwemeCaches_old\n `);
|
|
8595
|
+
await this.runQuery("DROP TABLE AwemeCaches_old");
|
|
8596
|
+
logger.info("[DouyinDB] AwemeCaches 表迁移完成");
|
|
8597
|
+
}
|
|
8598
|
+
} catch (error) {
|
|
8599
|
+
logger.error("[DouyinDB] 数据库迁移失败:", error);
|
|
8600
|
+
}
|
|
8601
|
+
}
|
|
8414
8602
|
async createTables() {
|
|
8415
8603
|
for (const query of [
|
|
8416
8604
|
`CREATE TABLE IF NOT EXISTS Bots (\n id TEXT PRIMARY KEY,\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP\n )`,
|
|
8417
8605
|
`CREATE TABLE IF NOT EXISTS Groups (\n id TEXT PRIMARY KEY,\n botId TEXT NOT NULL,\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (botId) REFERENCES Bots(id)\n )`,
|
|
8418
8606
|
`CREATE TABLE IF NOT EXISTS DouyinUsers (\n sec_uid TEXT PRIMARY KEY,\n short_id TEXT,\n remark TEXT,\n living INTEGER DEFAULT 0,\n filterMode TEXT DEFAULT 'blacklist',\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP\n )`,
|
|
8419
8607
|
`CREATE TABLE IF NOT EXISTS GroupUserSubscriptions (\n groupId TEXT,\n sec_uid TEXT,\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (groupId, sec_uid),\n FOREIGN KEY (groupId) REFERENCES Groups(id),\n FOREIGN KEY (sec_uid) REFERENCES DouyinUsers(sec_uid)\n )`,
|
|
8420
|
-
`CREATE TABLE IF NOT EXISTS AwemeCaches (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n aweme_id TEXT NOT NULL,\n sec_uid TEXT NOT NULL,\n groupId TEXT NOT NULL,\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (sec_uid) REFERENCES DouyinUsers(sec_uid),\n FOREIGN KEY (groupId) REFERENCES Groups(id),\n UNIQUE(aweme_id, sec_uid, groupId)\n )`,
|
|
8608
|
+
`CREATE TABLE IF NOT EXISTS AwemeCaches (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n aweme_id TEXT NOT NULL,\n sec_uid TEXT NOT NULL,\n groupId TEXT NOT NULL,\n pushType TEXT DEFAULT 'post',\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (sec_uid) REFERENCES DouyinUsers(sec_uid),\n FOREIGN KEY (groupId) REFERENCES Groups(id),\n UNIQUE(aweme_id, sec_uid, groupId, pushType)\n )`,
|
|
8421
8609
|
`CREATE TABLE IF NOT EXISTS FilterWords (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n sec_uid TEXT NOT NULL,\n word TEXT NOT NULL,\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (sec_uid) REFERENCES DouyinUsers(sec_uid),\n UNIQUE(sec_uid, word)\n )`,
|
|
8422
|
-
`CREATE TABLE IF NOT EXISTS FilterTags (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n sec_uid TEXT NOT NULL,\n tag TEXT NOT NULL,\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (sec_uid) REFERENCES DouyinUsers(sec_uid),\n UNIQUE(sec_uid, tag)\n )
|
|
8610
|
+
`CREATE TABLE IF NOT EXISTS FilterTags (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n sec_uid TEXT NOT NULL,\n tag TEXT NOT NULL,\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (sec_uid) REFERENCES DouyinUsers(sec_uid),\n UNIQUE(sec_uid, tag)\n )`,
|
|
8611
|
+
`CREATE TABLE IF NOT EXISTS ListSnapshots (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n sec_uid TEXT NOT NULL,\n pushType TEXT NOT NULL,\n aweme_id TEXT NOT NULL,\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (sec_uid) REFERENCES DouyinUsers(sec_uid),\n UNIQUE(sec_uid, pushType, aweme_id)\n )`
|
|
8423
8612
|
]) await this.runQuery(query);
|
|
8424
8613
|
}
|
|
8425
8614
|
runQuery(sql, params = []) {
|
|
@@ -8561,36 +8750,47 @@ var init_douyin = __esmMin(async () => {
|
|
|
8561
8750
|
await this.runQuery("DELETE FROM AwemeCaches WHERE groupId = ? AND sec_uid = ?", [groupId, sec_uid]);
|
|
8562
8751
|
return result.changes > 0;
|
|
8563
8752
|
}
|
|
8564
|
-
async addAwemeCache(aweme_id, sec_uid, groupId) {
|
|
8565
|
-
let cache = await this.getQuery("SELECT * FROM AwemeCaches WHERE aweme_id = ? AND sec_uid = ? AND groupId = ?", [
|
|
8753
|
+
async addAwemeCache(aweme_id, sec_uid, groupId, pushType = "post") {
|
|
8754
|
+
let cache = await this.getQuery("SELECT * FROM AwemeCaches WHERE aweme_id = ? AND sec_uid = ? AND groupId = ? AND pushType = ?", [
|
|
8566
8755
|
aweme_id,
|
|
8567
8756
|
sec_uid,
|
|
8568
|
-
groupId
|
|
8757
|
+
groupId,
|
|
8758
|
+
pushType
|
|
8569
8759
|
]);
|
|
8570
8760
|
if (!cache) {
|
|
8571
8761
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
8572
8762
|
cache = {
|
|
8573
|
-
id: (await this.runQuery("INSERT INTO AwemeCaches (aweme_id, sec_uid, groupId, createdAt, updatedAt) VALUES (?, ?, ?, ?, ?)", [
|
|
8763
|
+
id: (await this.runQuery("INSERT INTO AwemeCaches (aweme_id, sec_uid, groupId, pushType, createdAt, updatedAt) VALUES (?, ?, ?, ?, ?, ?)", [
|
|
8574
8764
|
aweme_id,
|
|
8575
8765
|
sec_uid,
|
|
8576
8766
|
groupId,
|
|
8767
|
+
pushType,
|
|
8577
8768
|
now,
|
|
8578
8769
|
now
|
|
8579
8770
|
])).lastID,
|
|
8580
8771
|
aweme_id,
|
|
8581
8772
|
sec_uid,
|
|
8582
8773
|
groupId,
|
|
8774
|
+
pushType,
|
|
8583
8775
|
createdAt: now,
|
|
8584
8776
|
updatedAt: now
|
|
8585
8777
|
};
|
|
8586
8778
|
}
|
|
8587
8779
|
return cache;
|
|
8588
8780
|
}
|
|
8589
|
-
async isAwemePushed(aweme_id, sec_uid, groupId) {
|
|
8590
|
-
return ((await this.getQuery("SELECT COUNT(*) as count FROM AwemeCaches WHERE aweme_id = ? AND sec_uid = ? AND groupId = ?", [
|
|
8781
|
+
async isAwemePushed(aweme_id, sec_uid, groupId, pushType = "post") {
|
|
8782
|
+
return ((await this.getQuery("SELECT COUNT(*) as count FROM AwemeCaches WHERE aweme_id = ? AND sec_uid = ? AND groupId = ? AND pushType = ?", [
|
|
8591
8783
|
aweme_id,
|
|
8592
8784
|
sec_uid,
|
|
8593
|
-
groupId
|
|
8785
|
+
groupId,
|
|
8786
|
+
pushType
|
|
8787
|
+
]))?.count || 0) > 0;
|
|
8788
|
+
}
|
|
8789
|
+
async hasHistory(sec_uid, groupId, pushType) {
|
|
8790
|
+
return ((await this.getQuery("SELECT COUNT(*) as count FROM AwemeCaches WHERE sec_uid = ? AND groupId = ? AND pushType = ? LIMIT 1", [
|
|
8791
|
+
sec_uid,
|
|
8792
|
+
groupId,
|
|
8793
|
+
pushType
|
|
8594
8794
|
]))?.count || 0) > 0;
|
|
8595
8795
|
}
|
|
8596
8796
|
async getBotGroups(botId) {
|
|
@@ -8871,6 +9071,24 @@ var init_douyin = __esmMin(async () => {
|
|
|
8871
9071
|
}
|
|
8872
9072
|
};
|
|
8873
9073
|
}
|
|
9074
|
+
async isAwemeInList(aweme_id, sec_uid, pushType) {
|
|
9075
|
+
return ((await this.getQuery("SELECT COUNT(*) as count FROM ListSnapshots WHERE aweme_id = ? AND sec_uid = ? AND pushType = ?", [
|
|
9076
|
+
aweme_id,
|
|
9077
|
+
sec_uid,
|
|
9078
|
+
pushType
|
|
9079
|
+
]))?.count || 0) > 0;
|
|
9080
|
+
}
|
|
9081
|
+
async updateListSnapshot(sec_uid, pushType, aweme_ids) {
|
|
9082
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
9083
|
+
await this.runQuery("DELETE FROM ListSnapshots WHERE sec_uid = ? AND pushType = ?", [sec_uid, pushType]);
|
|
9084
|
+
for (const aweme_id of aweme_ids) await this.runQuery("INSERT OR IGNORE INTO ListSnapshots (sec_uid, pushType, aweme_id, createdAt, updatedAt) VALUES (?, ?, ?, ?, ?)", [
|
|
9085
|
+
sec_uid,
|
|
9086
|
+
pushType,
|
|
9087
|
+
aweme_id,
|
|
9088
|
+
now,
|
|
9089
|
+
now
|
|
9090
|
+
]);
|
|
9091
|
+
}
|
|
8874
9092
|
};
|
|
8875
9093
|
});
|
|
8876
9094
|
var db_exports = __export({
|
|
@@ -14058,6 +14276,38 @@ const webConfig = defineConfig({
|
|
|
14058
14276
|
isRequired: false,
|
|
14059
14277
|
description: "博主的抖音名称"
|
|
14060
14278
|
}),
|
|
14279
|
+
components.divider.create("push:douyin:divider-pushTypes", {
|
|
14280
|
+
description: "推送类型配置",
|
|
14281
|
+
descPosition: 20
|
|
14282
|
+
}),
|
|
14283
|
+
components.checkbox.group("pushTypes", {
|
|
14284
|
+
label: "推送类型",
|
|
14285
|
+
description: "选择要推送的内容类型,可多选",
|
|
14286
|
+
orientation: "horizontal",
|
|
14287
|
+
color: "warning",
|
|
14288
|
+
checkbox: [
|
|
14289
|
+
components.checkbox.create("pushTypes:checkbox:post", {
|
|
14290
|
+
label: "作品列表",
|
|
14291
|
+
description: "推送博主发布的作品",
|
|
14292
|
+
value: "post"
|
|
14293
|
+
}),
|
|
14294
|
+
components.checkbox.create("pushTypes:checkbox:favorite", {
|
|
14295
|
+
label: "喜欢列表",
|
|
14296
|
+
description: "推送博主喜欢的作品",
|
|
14297
|
+
value: "favorite"
|
|
14298
|
+
}),
|
|
14299
|
+
components.checkbox.create("pushTypes:checkbox:recommend", {
|
|
14300
|
+
label: "推荐列表",
|
|
14301
|
+
description: "推送博主的推荐作品",
|
|
14302
|
+
value: "recommend"
|
|
14303
|
+
}),
|
|
14304
|
+
components.checkbox.create("pushTypes:checkbox:live", {
|
|
14305
|
+
label: "直播",
|
|
14306
|
+
description: "推送博主开播通知",
|
|
14307
|
+
value: "live"
|
|
14308
|
+
})
|
|
14309
|
+
]
|
|
14310
|
+
}),
|
|
14061
14311
|
components.divider.create("push:douyin:divider-1", {
|
|
14062
14312
|
description: "过滤系统",
|
|
14063
14313
|
descPosition: 20
|
|
@@ -16624,6 +16874,7 @@ var DouYin = class extends Base {
|
|
|
16624
16874
|
is_mp4;
|
|
16625
16875
|
is_slides;
|
|
16626
16876
|
forceBurnDanmaku;
|
|
16877
|
+
hasProcessedLiveImage;
|
|
16627
16878
|
get botadapter() {
|
|
16628
16879
|
return this.e.bot?.adapter?.name;
|
|
16629
16880
|
}
|
|
@@ -16634,6 +16885,7 @@ var DouYin = class extends Base {
|
|
|
16634
16885
|
this.is_mp4 = iddata?.is_mp4;
|
|
16635
16886
|
this.is_slides = false;
|
|
16636
16887
|
this.forceBurnDanmaku = options?.forceBurnDanmaku ?? false;
|
|
16888
|
+
this.hasProcessedLiveImage = false;
|
|
16637
16889
|
}
|
|
16638
16890
|
async DouyinHandler(data$1) {
|
|
16639
16891
|
if (Config.app.EmojiReply && !this.e.isPrivate) try {
|
|
@@ -16664,36 +16916,121 @@ var DouYin = class extends Base {
|
|
|
16664
16916
|
const imageres = [];
|
|
16665
16917
|
let image_url = "";
|
|
16666
16918
|
const images = VideoData.data.aweme_detail.images ?? [];
|
|
16667
|
-
|
|
16668
|
-
|
|
16919
|
+
if (images.some((item) => item.clip_type !== 2)) {
|
|
16920
|
+
const processedImages = [];
|
|
16921
|
+
const temp = [];
|
|
16669
16922
|
g_title = VideoData.data.aweme_detail.preview_title.substring(0, 50).replace(/[\\/:*?"<>|\r\n]/g, " ");
|
|
16670
|
-
|
|
16671
|
-
|
|
16672
|
-
|
|
16673
|
-
|
|
16674
|
-
|
|
16675
|
-
|
|
16676
|
-
|
|
16677
|
-
|
|
16678
|
-
|
|
16923
|
+
let mp3Path = "";
|
|
16924
|
+
if (VideoData.data.aweme_detail.music.play_url.uri === "") mp3Path = JSON.parse(VideoData.data.aweme_detail.music.extra).original_song_url;
|
|
16925
|
+
else mp3Path = VideoData.data.aweme_detail.music.play_url.uri;
|
|
16926
|
+
const liveimgbgm = await downloadFile(mp3Path, {
|
|
16927
|
+
title: `Douyin_tmp_A_${Date.now()}.mp3`,
|
|
16928
|
+
headers: this.headers
|
|
16929
|
+
});
|
|
16930
|
+
temp.push(liveimgbgm);
|
|
16931
|
+
const mergeMode = Config.douyin.liveImageMergeMode ?? "independent";
|
|
16932
|
+
let bgmContext = null;
|
|
16933
|
+
if (mergeMode === "continuous") bgmContext = await createLiveImageContext(liveimgbgm.filepath);
|
|
16934
|
+
for (const [index, imageItem] of images.entries()) {
|
|
16935
|
+
imagenum++;
|
|
16936
|
+
if (imageItem.clip_type === 2) {
|
|
16937
|
+
image_url = imageItem.url_list[2] || imageItem.url_list[1];
|
|
16938
|
+
processedImages.push(segment.image(image_url));
|
|
16939
|
+
if (Config.app.removeCache === false) {
|
|
16940
|
+
mkdirSync(`${Common.tempDri.images}${g_title}`);
|
|
16941
|
+
const path$1 = `${Common.tempDri.images}${g_title}/${index + 1}.png`;
|
|
16942
|
+
await new Network({
|
|
16943
|
+
url: image_url,
|
|
16944
|
+
type: "arraybuffer"
|
|
16945
|
+
}).getData().then((data$2) => fs.promises.writeFile(path$1, Buffer.from(data$2)));
|
|
16946
|
+
}
|
|
16947
|
+
continue;
|
|
16948
|
+
}
|
|
16949
|
+
const liveimg = await downloadFile(`https://aweme.snssdk.com/aweme/v1/play/?video_id=${imageItem.video.play_addr_h264.uri}&ratio=1080p&line=0`, {
|
|
16950
|
+
title: `Douyin_tmp_V_${Date.now()}.mp4`,
|
|
16951
|
+
headers: this.headers
|
|
16952
|
+
});
|
|
16953
|
+
if (liveimg.filepath) {
|
|
16954
|
+
const outputPath = Common.tempDri.video + `Douyin_Result_${Date.now()}.mp4`;
|
|
16955
|
+
let success;
|
|
16956
|
+
const loopCount = imageItem.clip_type === 4 ? 1 : 3;
|
|
16957
|
+
if (mergeMode === "continuous" && bgmContext) {
|
|
16958
|
+
const result = await mergeLiveImageContinuous({
|
|
16959
|
+
videoPath: liveimg.filepath,
|
|
16960
|
+
outputPath,
|
|
16961
|
+
loopCount
|
|
16962
|
+
}, bgmContext);
|
|
16963
|
+
success = result.success;
|
|
16964
|
+
bgmContext = result.context;
|
|
16965
|
+
} else success = await mergeLiveImageIndependent({
|
|
16966
|
+
videoPath: liveimg.filepath,
|
|
16967
|
+
outputPath,
|
|
16968
|
+
loopCount
|
|
16969
|
+
}, liveimgbgm.filepath);
|
|
16970
|
+
if (success) {
|
|
16971
|
+
const filePath = Common.tempDri.video + `tmp_${Date.now()}.mp4`;
|
|
16972
|
+
fs.renameSync(outputPath, filePath);
|
|
16973
|
+
logger.mark(`视频文件重命名完成: ${outputPath.split("/").pop()} -> ${filePath.split("/").pop()}`);
|
|
16974
|
+
logger.mark("正在尝试删除缓存文件");
|
|
16975
|
+
await Common.removeFile(liveimg.filepath, true);
|
|
16976
|
+
temp.push({
|
|
16977
|
+
filepath: filePath,
|
|
16978
|
+
totalBytes: 0
|
|
16979
|
+
});
|
|
16980
|
+
processedImages.push(segment.video("file://" + filePath));
|
|
16981
|
+
if (imageItem.clip_type === 5 && imageItem.url_list?.[0]) processedImages.push(segment.image(imageItem.url_list[0]));
|
|
16982
|
+
} else await Common.removeFile(liveimg.filepath, true);
|
|
16983
|
+
}
|
|
16984
|
+
}
|
|
16985
|
+
const Element = common.makeForward(processedImages, this.e.sender.userId, this.e.sender.nick);
|
|
16986
|
+
try {
|
|
16987
|
+
await this.e.bot.sendForwardMsg(this.e.contact, Element, {
|
|
16988
|
+
source: "图集内容",
|
|
16989
|
+
summary: `查看${Element.length}张图片/视频消息`,
|
|
16990
|
+
prompt: "抖音图集解析结果",
|
|
16991
|
+
news: [{ text: "点击查看解析结果" }]
|
|
16992
|
+
});
|
|
16993
|
+
} catch (error) {
|
|
16994
|
+
await this.e.reply(JSON.stringify(error, null, 2));
|
|
16995
|
+
} finally {
|
|
16996
|
+
for (const item of temp) await Common.removeFile(item.filepath, true);
|
|
16679
16997
|
}
|
|
16998
|
+
this.hasProcessedLiveImage = true;
|
|
16999
|
+
} else {
|
|
17000
|
+
for (const [index, imageItem] of images.entries()) {
|
|
17001
|
+
image_url = imageItem.url_list[2] || imageItem.url_list[1];
|
|
17002
|
+
g_title = VideoData.data.aweme_detail.preview_title.substring(0, 50).replace(/[\\/:*?"<>|\r\n]/g, " ");
|
|
17003
|
+
imageres.push(segment.image(image_url));
|
|
17004
|
+
imagenum++;
|
|
17005
|
+
if (Config.app.removeCache === false) {
|
|
17006
|
+
mkdirSync(`${Common.tempDri.images}${g_title}`);
|
|
17007
|
+
const path$1 = `${Common.tempDri.images}${g_title}/${index + 1}.png`;
|
|
17008
|
+
await new Network({
|
|
17009
|
+
url: image_url,
|
|
17010
|
+
type: "arraybuffer"
|
|
17011
|
+
}).getData().then((data$2) => fs.promises.writeFile(path$1, Buffer.from(data$2)));
|
|
17012
|
+
}
|
|
17013
|
+
}
|
|
17014
|
+
const res = common.makeForward(imageres, this.e.sender.userId, this.e.sender.nick);
|
|
17015
|
+
image_data.push(res);
|
|
17016
|
+
image_res.push(image_data);
|
|
17017
|
+
if (imageres.length === 1) await this.e.reply(segment.image(image_url));
|
|
17018
|
+
else await this.e.bot.sendForwardMsg(this.e.contact, res, {
|
|
17019
|
+
source: "图片合集",
|
|
17020
|
+
summary: `查看${res.length}张图片消息`,
|
|
17021
|
+
prompt: "抖音图集解析结果",
|
|
17022
|
+
news: [{ text: "点击查看解析结果" }]
|
|
17023
|
+
});
|
|
16680
17024
|
}
|
|
16681
|
-
const res = common.makeForward(imageres, this.e.sender.userId, this.e.sender.nick);
|
|
16682
|
-
image_data.push(res);
|
|
16683
|
-
image_res.push(image_data);
|
|
16684
|
-
if (imageres.length === 1) await this.e.reply(segment.image(image_url));
|
|
16685
|
-
else await this.e.bot.sendForwardMsg(this.e.contact, res, {
|
|
16686
|
-
source: "图片合集",
|
|
16687
|
-
summary: `查看${res.length}张图片消息`,
|
|
16688
|
-
prompt: "抖音图集解析结果",
|
|
16689
|
-
news: [{ text: "点击查看解析结果" }]
|
|
16690
|
-
});
|
|
16691
17025
|
break;
|
|
16692
17026
|
}
|
|
16693
17027
|
case VideoData.data.aweme_detail.is_slides === true && VideoData.data.aweme_detail.images !== null: {
|
|
16694
17028
|
const images = [];
|
|
16695
17029
|
const temp = [];
|
|
16696
|
-
|
|
17030
|
+
let mp3Path = "";
|
|
17031
|
+
if (VideoData.data.aweme_detail.music.play_url.uri === "") mp3Path = JSON.parse(VideoData.data.aweme_detail.music.extra).original_song_url;
|
|
17032
|
+
else mp3Path = VideoData.data.aweme_detail.music.play_url.uri;
|
|
17033
|
+
const liveimgbgm = await downloadFile(mp3Path, {
|
|
16697
17034
|
title: `Douyin_tmp_A_${Date.now()}.mp3`,
|
|
16698
17035
|
headers: this.headers
|
|
16699
17036
|
});
|
|
@@ -16716,18 +17053,19 @@ var DouYin = class extends Base {
|
|
|
16716
17053
|
if (liveimg.filepath) {
|
|
16717
17054
|
const outputPath = Common.tempDri.video + `Douyin_Result_${Date.now()}.mp4`;
|
|
16718
17055
|
let success;
|
|
17056
|
+
const loopCount = item.clip_type === 4 ? 1 : 3;
|
|
16719
17057
|
if (mergeMode === "continuous" && bgmContext) {
|
|
16720
17058
|
const result = await mergeLiveImageContinuous({
|
|
16721
17059
|
videoPath: liveimg.filepath,
|
|
16722
17060
|
outputPath,
|
|
16723
|
-
loopCount
|
|
17061
|
+
loopCount
|
|
16724
17062
|
}, bgmContext);
|
|
16725
17063
|
success = result.success;
|
|
16726
17064
|
bgmContext = result.context;
|
|
16727
17065
|
} else success = await mergeLiveImageIndependent({
|
|
16728
17066
|
videoPath: liveimg.filepath,
|
|
16729
17067
|
outputPath,
|
|
16730
|
-
loopCount
|
|
17068
|
+
loopCount
|
|
16731
17069
|
}, liveimgbgm.filepath);
|
|
16732
17070
|
if (success) {
|
|
16733
17071
|
const filePath = Common.tempDri.video + `tmp_${Date.now()}.mp4`;
|
|
@@ -16740,6 +17078,7 @@ var DouYin = class extends Base {
|
|
|
16740
17078
|
totalBytes: 0
|
|
16741
17079
|
});
|
|
16742
17080
|
images.push(segment.video("file://" + filePath));
|
|
17081
|
+
if (item.clip_type === 5 && item.url_list?.[0]) images.push(segment.image(item.url_list[0]));
|
|
16743
17082
|
} else await Common.removeFile(liveimg.filepath, true);
|
|
16744
17083
|
}
|
|
16745
17084
|
}
|
|
@@ -16760,7 +17099,10 @@ var DouYin = class extends Base {
|
|
|
16760
17099
|
}
|
|
16761
17100
|
}
|
|
16762
17101
|
if (VideoData.data.aweme_detail.music) {
|
|
16763
|
-
const
|
|
17102
|
+
const music = VideoData.data.aweme_detail.music;
|
|
17103
|
+
let music_url = "";
|
|
17104
|
+
if (music.play_url.uri === "") music_url = JSON.parse(music.extra).original_song_url;
|
|
17105
|
+
else music_url = music.play_url.uri;
|
|
16764
17106
|
if (this.is_mp4 === false && Config.app.removeCache === false && music_url !== void 0) try {
|
|
16765
17107
|
const path$1 = Common.tempDri.images + `${g_title}/BGM.mp3`;
|
|
16766
17108
|
await new Network({
|
|
@@ -16770,7 +17112,7 @@ var DouYin = class extends Base {
|
|
|
16770
17112
|
} catch (error) {
|
|
16771
17113
|
console.log(error);
|
|
16772
17114
|
}
|
|
16773
|
-
music_url && this.is_mp4 === false && music_url !== void 0 && await this.e.reply(segment.record(music_url, false));
|
|
17115
|
+
music_url && this.is_mp4 === false && music_url !== void 0 && !this.hasProcessedLiveImage && await this.e.reply(segment.record(music_url, false));
|
|
16774
17116
|
}
|
|
16775
17117
|
let FPS;
|
|
16776
17118
|
let video = null;
|
|
@@ -17265,6 +17607,197 @@ const getDouyinID = async (event, url, log = true) => {
|
|
|
17265
17607
|
log && console.log(result);
|
|
17266
17608
|
return result;
|
|
17267
17609
|
};
|
|
17610
|
+
await init_module();
|
|
17611
|
+
await init_amagiClient();
|
|
17612
|
+
async function processFavoriteList(contentList, sec_uid, userinfo, item, targets, force = false) {
|
|
17613
|
+
const pushType = "favorite";
|
|
17614
|
+
const listName = "喜欢列表";
|
|
17615
|
+
const result = [];
|
|
17616
|
+
const groupHistoryStatus = /* @__PURE__ */ new Map();
|
|
17617
|
+
for (const target of targets) {
|
|
17618
|
+
const hasHistory = await douyinDBInstance.hasHistory(sec_uid, target.groupId, pushType);
|
|
17619
|
+
groupHistoryStatus.set(target.groupId, hasHistory);
|
|
17620
|
+
}
|
|
17621
|
+
for (const [index, aweme] of contentList.entries()) {
|
|
17622
|
+
const validTargets = [];
|
|
17623
|
+
for (const target of targets) if (!await douyinDBInstance.isAwemePushed(aweme.aweme_id, sec_uid, target.groupId, pushType)) {
|
|
17624
|
+
const hasHistory = groupHistoryStatus.get(target.groupId);
|
|
17625
|
+
if (force || hasHistory || index === 0) validTargets.push(target);
|
|
17626
|
+
else {
|
|
17627
|
+
await douyinDBInstance.addAwemeCache(aweme.aweme_id, sec_uid, target.groupId, pushType);
|
|
17628
|
+
logger.debug(`新订阅群组 ${target.groupId} 跳过旧作品 ${aweme.aweme_id} 并已标记为已读`);
|
|
17629
|
+
}
|
|
17630
|
+
}
|
|
17631
|
+
if (validTargets.length === 0) continue;
|
|
17632
|
+
let authorUserInfo;
|
|
17633
|
+
try {
|
|
17634
|
+
if (aweme.author?.sec_uid) {
|
|
17635
|
+
authorUserInfo = await douyinFetcher.fetchUserProfile({
|
|
17636
|
+
sec_uid: aweme.author.sec_uid,
|
|
17637
|
+
typeMode: "strict"
|
|
17638
|
+
});
|
|
17639
|
+
logger.debug(`获取作品作者 ${aweme.author.nickname} 的用户信息成功`);
|
|
17640
|
+
}
|
|
17641
|
+
} catch (error) {
|
|
17642
|
+
logger.warn(`获取作品作者用户信息失败: ${error}`);
|
|
17643
|
+
}
|
|
17644
|
+
result.push({
|
|
17645
|
+
remark: item.remark,
|
|
17646
|
+
sec_uid,
|
|
17647
|
+
create_time: aweme.create_time,
|
|
17648
|
+
targets: validTargets,
|
|
17649
|
+
pushType,
|
|
17650
|
+
Detail_Data: {
|
|
17651
|
+
...aweme,
|
|
17652
|
+
user_info: userinfo,
|
|
17653
|
+
author_user_info: authorUserInfo
|
|
17654
|
+
},
|
|
17655
|
+
avatar_img: "https://p3-pc.douyinpic.com/aweme/1080x1080/" + userinfo.data.user.avatar_larger.uri,
|
|
17656
|
+
living: false
|
|
17657
|
+
});
|
|
17658
|
+
logger.debug(`发现新${listName}作品:${aweme.aweme_id}`);
|
|
17659
|
+
}
|
|
17660
|
+
await douyinDBInstance.updateListSnapshot(sec_uid, pushType, contentList.map((a) => a.aweme_id));
|
|
17661
|
+
return result;
|
|
17662
|
+
}
|
|
17663
|
+
await init_module();
|
|
17664
|
+
async function processLiveStream(sec_uid, userinfo, item, targets, amagi) {
|
|
17665
|
+
const pushType = "live";
|
|
17666
|
+
const liveStatus = await douyinDBInstance.getLiveStatus(sec_uid);
|
|
17667
|
+
if (userinfo.data.user.live_status === 1) {
|
|
17668
|
+
const UserInfoData = await amagi.douyin.fetcher.fetchUserProfile({
|
|
17669
|
+
sec_uid: userinfo.data.user.sec_uid,
|
|
17670
|
+
typeMode: "strict"
|
|
17671
|
+
});
|
|
17672
|
+
if (!UserInfoData.data.user?.live_status || UserInfoData.data.user.live_status !== 1) {
|
|
17673
|
+
logger.error((UserInfoData?.data?.user?.nickname ?? "用户") + "当前未在直播");
|
|
17674
|
+
return null;
|
|
17675
|
+
}
|
|
17676
|
+
if (!UserInfoData.data.user.room_data) {
|
|
17677
|
+
logger.error("未获取到直播间信息!");
|
|
17678
|
+
return null;
|
|
17679
|
+
}
|
|
17680
|
+
const room_data = JSON.parse(UserInfoData.data.user.room_data);
|
|
17681
|
+
const liveInfo = await amagi.douyin.fetcher.fetchLiveRoomInfo({
|
|
17682
|
+
room_id: UserInfoData.data.user.room_id_str,
|
|
17683
|
+
web_rid: room_data.owner.web_rid,
|
|
17684
|
+
typeMode: "strict"
|
|
17685
|
+
});
|
|
17686
|
+
if (!liveStatus.living) {
|
|
17687
|
+
await douyinDBInstance.updateLiveStatus(sec_uid, true);
|
|
17688
|
+
logger.info(`用户 ${item.remark ?? sec_uid} 开播了`);
|
|
17689
|
+
return {
|
|
17690
|
+
remark: item.remark,
|
|
17691
|
+
sec_uid,
|
|
17692
|
+
create_time: Date.now(),
|
|
17693
|
+
targets,
|
|
17694
|
+
pushType,
|
|
17695
|
+
Detail_Data: {
|
|
17696
|
+
user_info: userinfo,
|
|
17697
|
+
room_data: JSON.parse(userinfo.data.user.room_data),
|
|
17698
|
+
live_data: liveInfo,
|
|
17699
|
+
liveStatus: {
|
|
17700
|
+
liveStatus: "open",
|
|
17701
|
+
isChanged: true,
|
|
17702
|
+
isliving: true
|
|
17703
|
+
}
|
|
17704
|
+
},
|
|
17705
|
+
avatar_img: "https://p3-pc.douyinpic.com/aweme/1080x1080/" + userinfo.data.user.avatar_larger.uri,
|
|
17706
|
+
living: true
|
|
17707
|
+
};
|
|
17708
|
+
}
|
|
17709
|
+
} else if (liveStatus.living) {
|
|
17710
|
+
await douyinDBInstance.updateLiveStatus(sec_uid, false);
|
|
17711
|
+
logger.info(`用户 ${item.remark ?? sec_uid} 已关播,更新直播状态`);
|
|
17712
|
+
}
|
|
17713
|
+
return null;
|
|
17714
|
+
}
|
|
17715
|
+
await init_date_fns();
|
|
17716
|
+
await init_module();
|
|
17717
|
+
async function processPostList(contentList, sec_uid, userinfo, item, targets) {
|
|
17718
|
+
const pushType = "post";
|
|
17719
|
+
const listName = "作品列表";
|
|
17720
|
+
const result = [];
|
|
17721
|
+
for (const aweme of contentList) {
|
|
17722
|
+
const nowSeconds = Math.floor(Date.now() / 1e3);
|
|
17723
|
+
const createTime = aweme.create_time;
|
|
17724
|
+
const timeDifference = nowSeconds - createTime;
|
|
17725
|
+
const is_top = aweme.is_top === 1;
|
|
17726
|
+
const timeDiffHours = Math.round(timeDifference / 3600 * 100) / 100;
|
|
17727
|
+
logger.trace(`\n 前期获取该作品基本信息:\n 推送类型:${pushType}(${listName})\n 作者:${aweme.author.nickname}\n 作品ID:${aweme.aweme_id}\n 发布时间:${format(fromUnixTime(aweme.create_time), "yyyy-MM-dd HH:mm")}\n 发布时间戳(s):${createTime}\n 当前时间戳(s):${nowSeconds}\n 时间差(s):${timeDifference}s (${timeDiffHours}h)\n 是否置顶:${is_top}\n 是否在一天内:${timeDifference < 86400 ? logger.green("true") : logger.red("false")}\n `);
|
|
17728
|
+
if (is_top && timeDifference < 86400 || timeDifference < 86400 && !is_top) {
|
|
17729
|
+
const validTargets = [];
|
|
17730
|
+
for (const target of targets) if (!await douyinDBInstance.isAwemePushed(aweme.aweme_id, sec_uid, target.groupId, pushType)) validTargets.push(target);
|
|
17731
|
+
if (validTargets.length > 0) result.push({
|
|
17732
|
+
remark: item.remark,
|
|
17733
|
+
sec_uid,
|
|
17734
|
+
create_time: aweme.create_time,
|
|
17735
|
+
targets: validTargets,
|
|
17736
|
+
pushType,
|
|
17737
|
+
Detail_Data: {
|
|
17738
|
+
...aweme,
|
|
17739
|
+
user_info: userinfo
|
|
17740
|
+
},
|
|
17741
|
+
avatar_img: "https://p3-pc.douyinpic.com/aweme/1080x1080/" + userinfo.data.user.avatar_larger.uri,
|
|
17742
|
+
living: false
|
|
17743
|
+
});
|
|
17744
|
+
}
|
|
17745
|
+
}
|
|
17746
|
+
return result;
|
|
17747
|
+
}
|
|
17748
|
+
await init_module();
|
|
17749
|
+
await init_amagiClient();
|
|
17750
|
+
async function processRecommendList(contentList, sec_uid, userinfo, item, targets, force = false) {
|
|
17751
|
+
const pushType = "recommend";
|
|
17752
|
+
const listName = "推荐列表";
|
|
17753
|
+
const result = [];
|
|
17754
|
+
const groupHistoryStatus = /* @__PURE__ */ new Map();
|
|
17755
|
+
for (const target of targets) {
|
|
17756
|
+
const hasHistory = await douyinDBInstance.hasHistory(sec_uid, target.groupId, pushType);
|
|
17757
|
+
groupHistoryStatus.set(target.groupId, hasHistory);
|
|
17758
|
+
}
|
|
17759
|
+
for (const [index, aweme] of contentList.entries()) {
|
|
17760
|
+
const validTargets = [];
|
|
17761
|
+
for (const target of targets) if (!await douyinDBInstance.isAwemePushed(aweme.aweme_id, sec_uid, target.groupId, pushType)) {
|
|
17762
|
+
const hasHistory = groupHistoryStatus.get(target.groupId);
|
|
17763
|
+
if (force || hasHistory || index === 0) validTargets.push(target);
|
|
17764
|
+
else {
|
|
17765
|
+
await douyinDBInstance.addAwemeCache(aweme.aweme_id, sec_uid, target.groupId, pushType);
|
|
17766
|
+
logger.debug(`新订阅群组 ${target.groupId} 跳过旧作品 ${aweme.aweme_id} 并已标记为已读`);
|
|
17767
|
+
}
|
|
17768
|
+
}
|
|
17769
|
+
if (validTargets.length === 0) continue;
|
|
17770
|
+
let authorUserInfo;
|
|
17771
|
+
try {
|
|
17772
|
+
if (aweme.author?.sec_uid) {
|
|
17773
|
+
authorUserInfo = await douyinFetcher.fetchUserProfile({
|
|
17774
|
+
sec_uid: aweme.author.sec_uid,
|
|
17775
|
+
typeMode: "strict"
|
|
17776
|
+
});
|
|
17777
|
+
logger.debug(`获取作品作者 ${aweme.author.nickname} 的用户信息成功`);
|
|
17778
|
+
}
|
|
17779
|
+
} catch (error) {
|
|
17780
|
+
logger.warn(`获取作品作者用户信息失败: ${error}`);
|
|
17781
|
+
}
|
|
17782
|
+
result.push({
|
|
17783
|
+
remark: item.remark,
|
|
17784
|
+
sec_uid,
|
|
17785
|
+
create_time: aweme.create_time,
|
|
17786
|
+
targets: validTargets,
|
|
17787
|
+
pushType,
|
|
17788
|
+
Detail_Data: {
|
|
17789
|
+
...aweme,
|
|
17790
|
+
user_info: userinfo,
|
|
17791
|
+
author_user_info: authorUserInfo
|
|
17792
|
+
},
|
|
17793
|
+
avatar_img: "https://p3-pc.douyinpic.com/aweme/1080x1080/" + userinfo.data.user.avatar_larger.uri,
|
|
17794
|
+
living: false
|
|
17795
|
+
});
|
|
17796
|
+
logger.debug(`发现新${listName}作品:${aweme.aweme_id}`);
|
|
17797
|
+
}
|
|
17798
|
+
await douyinDBInstance.updateListSnapshot(sec_uid, pushType, contentList.map((a) => a.aweme_id));
|
|
17799
|
+
return result;
|
|
17800
|
+
}
|
|
17268
17801
|
await init_date_fns();
|
|
17269
17802
|
await init_module();
|
|
17270
17803
|
await init_Config();
|
|
@@ -17290,6 +17823,7 @@ var DouYinpush = class extends Base {
|
|
|
17290
17823
|
const deletedCount = await cleanOldDynamicCache("douyin");
|
|
17291
17824
|
if (deletedCount > 0) logger.info(`已清理 ${deletedCount} 条过期的抖音作品缓存记录`);
|
|
17292
17825
|
if (await this.checkremark()) return true;
|
|
17826
|
+
this.ensureConfigFields(Config.pushlist.douyin);
|
|
17293
17827
|
const registeredBotIds = karin$1.getAllBotID();
|
|
17294
17828
|
const filteredPushList = this.filterPushListByRegisteredBots(Config.pushlist.douyin, registeredBotIds);
|
|
17295
17829
|
if (filteredPushList.length === 0) {
|
|
@@ -17301,6 +17835,30 @@ var DouYinpush = class extends Base {
|
|
|
17301
17835
|
if (this.force) return await this.forcepush(data$1);
|
|
17302
17836
|
else return await this.getdata(data$1);
|
|
17303
17837
|
}
|
|
17838
|
+
ensureConfigFields(pushList) {
|
|
17839
|
+
if (!pushList || pushList.length === 0) return;
|
|
17840
|
+
let hasChanges = false;
|
|
17841
|
+
for (const item of pushList) {
|
|
17842
|
+
if (!item.pushTypes || item.pushTypes.length === 0) {
|
|
17843
|
+
item.pushTypes = [
|
|
17844
|
+
"post",
|
|
17845
|
+
"live",
|
|
17846
|
+
"favorite",
|
|
17847
|
+
"recommend"
|
|
17848
|
+
];
|
|
17849
|
+
hasChanges = true;
|
|
17850
|
+
logger.info(`为用户 ${item.remark ?? item.sec_uid} 自动补全推送类型:作品列表、直播、收藏、推荐`);
|
|
17851
|
+
}
|
|
17852
|
+
if (item.switch === void 0) {
|
|
17853
|
+
item.switch = true;
|
|
17854
|
+
hasChanges = true;
|
|
17855
|
+
}
|
|
17856
|
+
}
|
|
17857
|
+
if (hasChanges) {
|
|
17858
|
+
Config.Modify("pushlist", "douyin", pushList);
|
|
17859
|
+
logger.info("已自动补全配置文件中缺失的字段并保存");
|
|
17860
|
+
}
|
|
17861
|
+
}
|
|
17304
17862
|
filterPushListByRegisteredBots(pushList, registeredBotIds) {
|
|
17305
17863
|
if (!pushList || pushList.length === 0) return [];
|
|
17306
17864
|
const registeredSet = new Set(registeredBotIds);
|
|
@@ -17327,18 +17885,20 @@ var DouYinpush = class extends Base {
|
|
|
17327
17885
|
async getdata(data$1) {
|
|
17328
17886
|
if (Object.keys(data$1).length === 0) return true;
|
|
17329
17887
|
for (const awemeId in data$1) {
|
|
17330
|
-
logger.mark(`\n ${logger.blue("开始处理并渲染抖音动态图片")}\n ${logger.blue("博主")}: ${logger.green(data$1[awemeId].remark)} \n ${logger.cyan("作品id")}:${logger.yellow(awemeId)}\n ${logger.cyan("访问地址")}:${logger.green("https://www.douyin.com/video/" + awemeId)}`);
|
|
17331
17888
|
const pushItem = data$1[awemeId];
|
|
17889
|
+
const actualAwemeId = awemeId.replace(/^(post|favorite|recommend|live)_/, "");
|
|
17890
|
+
const pushTypeLabel = pushItem.pushType === "post" ? "作品列表" : pushItem.pushType === "favorite" ? "喜欢列表" : pushItem.pushType === "recommend" ? "推荐列表" : "直播";
|
|
17891
|
+
logger.mark(`\n ${logger.blue("开始处理并渲染抖音动态图片")}\n ${logger.blue("博主")}: ${logger.green(pushItem.remark)} \n ${logger.blue("推送类型")}: ${logger.magenta(pushTypeLabel)}\n ${logger.cyan("作品id")}:${logger.yellow(actualAwemeId)}\n ${logger.cyan("访问地址")}:${logger.green("https://www.douyin.com/video/" + actualAwemeId)}`);
|
|
17332
17892
|
const Detail_Data = pushItem.Detail_Data;
|
|
17333
17893
|
const skip = await skipDynamic(pushItem);
|
|
17334
|
-
skip && logger.warn(`作品 https://www.douyin.com/video/${
|
|
17894
|
+
skip && logger.warn(`作品 https://www.douyin.com/video/${actualAwemeId} 已被处理,跳过`);
|
|
17335
17895
|
let img$2 = [];
|
|
17336
17896
|
let iddata = {
|
|
17337
17897
|
is_mp4: true,
|
|
17338
17898
|
type: "one_work"
|
|
17339
17899
|
};
|
|
17340
17900
|
if (!skip) iddata = await getDouyinID(this.e, Detail_Data.share_url ?? "https://live.douyin.com/" + Detail_Data.room_data?.owner.web_rid, false);
|
|
17341
|
-
if (!skip) if (pushItem.
|
|
17901
|
+
if (!skip) if (pushItem.pushType === "live" && "room_data" in pushItem.Detail_Data && Detail_Data.live_data) img$2 = await Render("douyin/live", {
|
|
17342
17902
|
image_url: Detail_Data.live_data.data.data.data[0]?.cover?.url_list[0] ?? Detail_Data.live_data.data.data.qrcode_url,
|
|
17343
17903
|
text: Detail_Data.live_data.data.data.data[0]?.title ?? "",
|
|
17344
17904
|
liveinf: `${Detail_Data.live_data.data.data.partition_road_map?.partition?.title ?? Detail_Data.live_data.data.data.data[0]?.title ?? "获取失败"} | 房间号: ${Detail_Data.room_data.owner.web_rid}`,
|
|
@@ -17360,7 +17920,45 @@ var DouYinpush = class extends Base {
|
|
|
17360
17920
|
Connection: "keep-alive"
|
|
17361
17921
|
}
|
|
17362
17922
|
}).getLocation();
|
|
17363
|
-
|
|
17923
|
+
if (pushItem.pushType === "favorite") {
|
|
17924
|
+
const authorUserInfo = "author_user_info" in Detail_Data ? Detail_Data.author_user_info : void 0;
|
|
17925
|
+
img$2 = await Render("douyin/favorite-list", {
|
|
17926
|
+
image_url: iddata.is_mp4 ? Detail_Data.video.animated_cover?.url_list[0] ?? Detail_Data.video.cover.url_list[0] : Detail_Data.images[0].url_list[0],
|
|
17927
|
+
desc: this.desc(Detail_Data, Detail_Data.desc),
|
|
17928
|
+
dianzan: this.count(Detail_Data.statistics.digg_count),
|
|
17929
|
+
pinglun: this.count(Detail_Data.statistics.comment_count),
|
|
17930
|
+
share: this.count(Detail_Data.statistics.share_count),
|
|
17931
|
+
shouchang: this.count(Detail_Data.statistics.collect_count),
|
|
17932
|
+
tuijian: this.count(Detail_Data.statistics.recommend_count),
|
|
17933
|
+
create_time: format(fromUnixTime(pushItem.create_time), "yyyy-MM-dd HH:mm"),
|
|
17934
|
+
liker_username: pushItem.remark,
|
|
17935
|
+
liker_avatar: "https://p3-pc.douyinpic.com/aweme/1080x1080/" + Detail_Data.user_info.data.user.avatar_larger.uri,
|
|
17936
|
+
liker_douyin_id: Detail_Data.user_info.data.user.unique_id === "" ? Detail_Data.user_info.data.user.short_id : Detail_Data.user_info.data.user.unique_id,
|
|
17937
|
+
author_username: Detail_Data.author.nickname,
|
|
17938
|
+
author_avatar: "https://p3-pc.douyinpic.com/aweme/1080x1080/" + authorUserInfo.data.user.avatar_larger.uri,
|
|
17939
|
+
author_douyin_id: authorUserInfo.data.user.unique_id === "" ? authorUserInfo.data.user.short_id : authorUserInfo.data.user.unique_id,
|
|
17940
|
+
share_url: Config.douyin.push.shareType === "web" ? realUrl : `https://aweme.snssdk.com/aweme/v1/play/?video_id=${Detail_Data.video.play_addr.uri}&ratio=1080p&line=0`
|
|
17941
|
+
});
|
|
17942
|
+
} else if (pushItem.pushType === "recommend") {
|
|
17943
|
+
const authorUserInfo = "author_user_info" in Detail_Data ? Detail_Data.author_user_info : void 0;
|
|
17944
|
+
img$2 = await Render("douyin/recommend-list", {
|
|
17945
|
+
image_url: iddata.is_mp4 ? Detail_Data.video.animated_cover?.url_list[0] ?? Detail_Data.video.cover.url_list[0] : Detail_Data.images[0].url_list[0],
|
|
17946
|
+
desc: this.desc(Detail_Data, Detail_Data.desc),
|
|
17947
|
+
dianzan: this.count(Detail_Data.statistics.digg_count),
|
|
17948
|
+
pinglun: this.count(Detail_Data.statistics.comment_count),
|
|
17949
|
+
share: this.count(Detail_Data.statistics.share_count),
|
|
17950
|
+
shouchang: this.count(Detail_Data.statistics.collect_count),
|
|
17951
|
+
tuijian: this.count(Detail_Data.statistics.recommend_count),
|
|
17952
|
+
create_time: format(fromUnixTime(pushItem.create_time), "yyyy-MM-dd HH:mm"),
|
|
17953
|
+
recommender_username: pushItem.remark,
|
|
17954
|
+
recommender_avatar: "https://p3-pc.douyinpic.com/aweme/1080x1080/" + Detail_Data.user_info.data.user.avatar_larger.uri,
|
|
17955
|
+
recommender_douyin_id: Detail_Data.user_info.data.user.unique_id === "" ? Detail_Data.user_info.data.user.short_id : Detail_Data.user_info.data.user.unique_id,
|
|
17956
|
+
author_username: Detail_Data.author.nickname,
|
|
17957
|
+
author_avatar: "https://p3-pc.douyinpic.com/aweme/1080x1080/" + authorUserInfo.data.user.avatar_larger.uri,
|
|
17958
|
+
author_douyin_id: authorUserInfo.data.user.unique_id === "" ? authorUserInfo.data.user.short_id : authorUserInfo.data.user.unique_id,
|
|
17959
|
+
share_url: Config.douyin.push.shareType === "web" ? realUrl : `https://aweme.snssdk.com/aweme/v1/play/?video_id=${Detail_Data.video.play_addr.uri}&ratio=1080p&line=0`
|
|
17960
|
+
});
|
|
17961
|
+
} else img$2 = await Render("douyin/dynamic", {
|
|
17364
17962
|
image_url: iddata.is_mp4 ? Detail_Data.video.animated_cover?.url_list[0] ?? Detail_Data.video.cover.url_list[0] : Detail_Data.images[0].url_list[0],
|
|
17365
17963
|
desc: this.desc(Detail_Data, Detail_Data.desc),
|
|
17366
17964
|
dianzan: this.count(Detail_Data.statistics.digg_count),
|
|
@@ -17375,6 +17973,7 @@ var DouYinpush = class extends Base {
|
|
|
17375
17973
|
"粉丝": this.count(Detail_Data.user_info.data.user.follower_count),
|
|
17376
17974
|
"获赞": this.count(Detail_Data.user_info.data.user.total_favorited),
|
|
17377
17975
|
"关注": this.count(Detail_Data.user_info.data.user.following_count),
|
|
17976
|
+
dynamicTYPE: "作品动态推送",
|
|
17378
17977
|
cooperation_info: (() => {
|
|
17379
17978
|
const raw = Detail_Data.cooperation_info;
|
|
17380
17979
|
if (!raw) return void 0;
|
|
@@ -17405,7 +18004,7 @@ var DouYinpush = class extends Base {
|
|
|
17405
18004
|
if (!skip) {
|
|
17406
18005
|
const Contact = karin$1.contactGroup(groupId);
|
|
17407
18006
|
status = await karin$1.sendMsg(botId, Contact, img$2 ? [...img$2] : []);
|
|
17408
|
-
if (pushItem.
|
|
18007
|
+
if (pushItem.pushType === "live" && "room_data" in pushItem.Detail_Data && status.message_id) await douyinDBInstance.updateLiveStatus(pushItem.sec_uid, true);
|
|
17409
18008
|
if (Config.douyin.push.parsedynamic && status.message_id) {
|
|
17410
18009
|
logger.debug(`开始解析作品,类型为:${iddata.is_mp4 ? "视频" : "图集"}`);
|
|
17411
18010
|
if (iddata.is_mp4) try {
|
|
@@ -17434,19 +18033,186 @@ var DouYinpush = class extends Base {
|
|
|
17434
18033
|
throw new Error(`下载视频失败: ${error}`);
|
|
17435
18034
|
}
|
|
17436
18035
|
else if (!iddata.is_mp4 && iddata.type === "one_work") {
|
|
17437
|
-
|
|
17438
|
-
|
|
17439
|
-
|
|
17440
|
-
|
|
17441
|
-
|
|
18036
|
+
if (Detail_Data.is_slides === true && Detail_Data.images) {
|
|
18037
|
+
const images = [];
|
|
18038
|
+
const temp = [];
|
|
18039
|
+
let mp3Path = "";
|
|
18040
|
+
if (Detail_Data.music.play_url.uri === "") mp3Path = JSON.parse(Detail_Data.music.extra).original_song_url;
|
|
18041
|
+
else mp3Path = Detail_Data.music.play_url.uri;
|
|
18042
|
+
const liveimgbgm = await downloadFile(mp3Path, {
|
|
18043
|
+
title: `Douyin_tmp_A_${Date.now()}.mp3`,
|
|
18044
|
+
headers: douyinBaseHeaders
|
|
18045
|
+
});
|
|
18046
|
+
temp.push(liveimgbgm);
|
|
18047
|
+
const images1 = Detail_Data.images ?? [];
|
|
18048
|
+
if (!images1.length) logger.debug("未获取到合辑的图片数据");
|
|
18049
|
+
const mergeMode = Config.douyin.liveImageMergeMode ?? "independent";
|
|
18050
|
+
let bgmContext = null;
|
|
18051
|
+
if (mergeMode === "continuous") {
|
|
18052
|
+
const { createLiveImageContext: createLiveImageContext$1 } = await init_utils$1().then(() => utils_exports);
|
|
18053
|
+
bgmContext = await createLiveImageContext$1(liveimgbgm.filepath);
|
|
18054
|
+
}
|
|
18055
|
+
for (const item of images1) {
|
|
18056
|
+
if (item.clip_type === 2) {
|
|
18057
|
+
images.push(segment.image(item.url_list[0]));
|
|
18058
|
+
continue;
|
|
18059
|
+
}
|
|
18060
|
+
const liveimg = await downloadFile(`https://aweme.snssdk.com/aweme/v1/play/?video_id=${item.video.play_addr_h264.uri}&ratio=1080p&line=0`, {
|
|
18061
|
+
title: `Douyin_tmp_V_${Date.now()}.mp4`,
|
|
18062
|
+
headers: douyinBaseHeaders
|
|
18063
|
+
});
|
|
18064
|
+
if (liveimg.filepath) {
|
|
18065
|
+
const { Common: Common$1, mergeLiveImageContinuous: mergeLiveImageContinuous$1, mergeLiveImageIndependent: mergeLiveImageIndependent$1 } = await init_utils$1().then(() => utils_exports);
|
|
18066
|
+
const outputPath = Common$1.tempDri.video + `Douyin_Result_${Date.now()}.mp4`;
|
|
18067
|
+
let success;
|
|
18068
|
+
const loopCount = item.clip_type === 4 ? 1 : 3;
|
|
18069
|
+
if (mergeMode === "continuous" && bgmContext) {
|
|
18070
|
+
const result = await mergeLiveImageContinuous$1({
|
|
18071
|
+
videoPath: liveimg.filepath,
|
|
18072
|
+
outputPath,
|
|
18073
|
+
loopCount
|
|
18074
|
+
}, bgmContext);
|
|
18075
|
+
success = result.success;
|
|
18076
|
+
bgmContext = result.context;
|
|
18077
|
+
} else success = await mergeLiveImageIndependent$1({
|
|
18078
|
+
videoPath: liveimg.filepath,
|
|
18079
|
+
outputPath,
|
|
18080
|
+
loopCount
|
|
18081
|
+
}, liveimgbgm.filepath);
|
|
18082
|
+
if (success) {
|
|
18083
|
+
const fs$1 = await import("node:fs");
|
|
18084
|
+
const filePath = Common$1.tempDri.video + `tmp_${Date.now()}.mp4`;
|
|
18085
|
+
fs$1.default.renameSync(outputPath, filePath);
|
|
18086
|
+
logger.mark(`视频文件重命名完成: ${outputPath.split("/").pop()} -> ${filePath.split("/").pop()}`);
|
|
18087
|
+
logger.mark("正在尝试删除缓存文件");
|
|
18088
|
+
await Common$1.removeFile(liveimg.filepath, true);
|
|
18089
|
+
temp.push({
|
|
18090
|
+
filepath: filePath,
|
|
18091
|
+
totalBytes: 0
|
|
18092
|
+
});
|
|
18093
|
+
images.push(segment.video("file://" + filePath));
|
|
18094
|
+
if (item.clip_type === 5 && item.url_list?.[0]) images.push(segment.image(item.url_list[0]));
|
|
18095
|
+
} else await Common$1.removeFile(liveimg.filepath, true);
|
|
18096
|
+
}
|
|
18097
|
+
}
|
|
18098
|
+
const bot = karin$1.getBot(botId);
|
|
18099
|
+
const Element = common.makeForward(images, botId, bot.account.name);
|
|
18100
|
+
try {
|
|
18101
|
+
await bot.sendForwardMsg(Contact, Element, {
|
|
18102
|
+
source: "合辑内容",
|
|
18103
|
+
summary: `查看${Element.length}张图片/视频消息`,
|
|
18104
|
+
prompt: "抖音合辑解析结果",
|
|
18105
|
+
news: [{ text: "点击查看解析结果" }]
|
|
18106
|
+
});
|
|
18107
|
+
} catch (error) {
|
|
18108
|
+
logger.error(`发送合辑失败: ${error}`);
|
|
18109
|
+
} finally {
|
|
18110
|
+
for (const item of temp) {
|
|
18111
|
+
const { Common: Common$1 } = await init_utils$1().then(() => utils_exports);
|
|
18112
|
+
await Common$1.removeFile(item.filepath, true);
|
|
18113
|
+
}
|
|
18114
|
+
}
|
|
18115
|
+
} else if (Detail_Data.images) if (Detail_Data.images.some((item) => item.clip_type !== 2)) {
|
|
18116
|
+
const processedImages = [];
|
|
18117
|
+
const temp = [];
|
|
18118
|
+
let mp3Path = "";
|
|
18119
|
+
if (Detail_Data.music.play_url.uri === "") mp3Path = JSON.parse(Detail_Data.music.extra).original_song_url;
|
|
18120
|
+
else mp3Path = Detail_Data.music.play_url.uri;
|
|
18121
|
+
const liveimgbgm = await downloadFile(mp3Path, {
|
|
18122
|
+
title: `Douyin_tmp_A_${Date.now()}.mp3`,
|
|
18123
|
+
headers: douyinBaseHeaders
|
|
18124
|
+
});
|
|
18125
|
+
temp.push(liveimgbgm);
|
|
18126
|
+
const mergeMode = Config.douyin.liveImageMergeMode ?? "independent";
|
|
18127
|
+
let bgmContext = null;
|
|
18128
|
+
if (mergeMode === "continuous") {
|
|
18129
|
+
const { createLiveImageContext: createLiveImageContext$1 } = await init_utils$1().then(() => utils_exports);
|
|
18130
|
+
bgmContext = await createLiveImageContext$1(liveimgbgm.filepath);
|
|
18131
|
+
}
|
|
18132
|
+
for (const item of Detail_Data.images) {
|
|
18133
|
+
if (item.clip_type === 2) {
|
|
18134
|
+
const image_url = item.url_list[2] ?? item.url_list[1];
|
|
18135
|
+
processedImages.push(segment.image(image_url));
|
|
18136
|
+
continue;
|
|
18137
|
+
}
|
|
18138
|
+
const liveimg = await downloadFile(`https://aweme.snssdk.com/aweme/v1/play/?video_id=${item.video.play_addr_h264.uri}&ratio=1080p&line=0`, {
|
|
18139
|
+
title: `Douyin_tmp_V_${Date.now()}.mp4`,
|
|
18140
|
+
headers: douyinBaseHeaders
|
|
18141
|
+
});
|
|
18142
|
+
if (liveimg.filepath) {
|
|
18143
|
+
const { Common: Common$1, mergeLiveImageContinuous: mergeLiveImageContinuous$1, mergeLiveImageIndependent: mergeLiveImageIndependent$1 } = await init_utils$1().then(() => utils_exports);
|
|
18144
|
+
const outputPath = Common$1.tempDri.video + `Douyin_Result_${Date.now()}.mp4`;
|
|
18145
|
+
let success;
|
|
18146
|
+
const loopCount = item.clip_type === 4 ? 1 : 3;
|
|
18147
|
+
if (mergeMode === "continuous" && bgmContext) {
|
|
18148
|
+
const result = await mergeLiveImageContinuous$1({
|
|
18149
|
+
videoPath: liveimg.filepath,
|
|
18150
|
+
outputPath,
|
|
18151
|
+
loopCount
|
|
18152
|
+
}, bgmContext);
|
|
18153
|
+
success = result.success;
|
|
18154
|
+
bgmContext = result.context;
|
|
18155
|
+
} else success = await mergeLiveImageIndependent$1({
|
|
18156
|
+
videoPath: liveimg.filepath,
|
|
18157
|
+
outputPath,
|
|
18158
|
+
loopCount
|
|
18159
|
+
}, liveimgbgm.filepath);
|
|
18160
|
+
if (success) {
|
|
18161
|
+
const fs$1 = await import("node:fs");
|
|
18162
|
+
const filePath = Common$1.tempDri.video + `tmp_${Date.now()}.mp4`;
|
|
18163
|
+
fs$1.default.renameSync(outputPath, filePath);
|
|
18164
|
+
logger.mark(`视频文件重命名完成: ${outputPath.split("/").pop()} -> ${filePath.split("/").pop()}`);
|
|
18165
|
+
logger.mark("正在尝试删除缓存文件");
|
|
18166
|
+
await Common$1.removeFile(liveimg.filepath, true);
|
|
18167
|
+
temp.push({
|
|
18168
|
+
filepath: filePath,
|
|
18169
|
+
totalBytes: 0
|
|
18170
|
+
});
|
|
18171
|
+
processedImages.push(segment.video("file://" + filePath));
|
|
18172
|
+
if (item.clip_type === 5 && item.url_list?.[0]) processedImages.push(segment.image(item.url_list[0]));
|
|
18173
|
+
} else await Common$1.removeFile(liveimg.filepath, true);
|
|
18174
|
+
}
|
|
18175
|
+
}
|
|
18176
|
+
const bot = karin$1.getBot(botId);
|
|
18177
|
+
const Element = common.makeForward(processedImages, botId, bot.account.name);
|
|
18178
|
+
try {
|
|
18179
|
+
await bot.sendForwardMsg(Contact, Element, {
|
|
18180
|
+
source: "图集内容",
|
|
18181
|
+
summary: `查看${Element.length}张图片/视频消息`,
|
|
18182
|
+
prompt: "抖音图集解析结果",
|
|
18183
|
+
news: [{ text: "点击查看解析结果" }]
|
|
18184
|
+
});
|
|
18185
|
+
} catch (error) {
|
|
18186
|
+
logger.error(`发送图集失败: ${error}`);
|
|
18187
|
+
} finally {
|
|
18188
|
+
for (const item of temp) {
|
|
18189
|
+
const { Common: Common$1 } = await init_utils$1().then(() => utils_exports);
|
|
18190
|
+
await Common$1.removeFile(item.filepath, true);
|
|
18191
|
+
}
|
|
18192
|
+
}
|
|
18193
|
+
} else {
|
|
18194
|
+
const imageres = [];
|
|
18195
|
+
let image_url;
|
|
18196
|
+
for (const item of Detail_Data.images) {
|
|
18197
|
+
image_url = item.url_list[2] ?? item.url_list[1];
|
|
18198
|
+
imageres.push(segment.image(image_url));
|
|
18199
|
+
}
|
|
18200
|
+
const bot = karin$1.getBot(botId);
|
|
18201
|
+
if (imageres.length === 1) await bot.sendMsg(Contact, [segment.image(image_url)]);
|
|
18202
|
+
else {
|
|
18203
|
+
const forwardMsg = common.makeForward(imageres, botId, bot.account.name);
|
|
18204
|
+
await bot.sendForwardMsg(Contact, forwardMsg, {
|
|
18205
|
+
source: "图片合集",
|
|
18206
|
+
summary: `查看${forwardMsg.length}张图片消息`,
|
|
18207
|
+
prompt: "抖音图集解析结果",
|
|
18208
|
+
news: [{ text: "点击查看解析结果" }]
|
|
18209
|
+
});
|
|
18210
|
+
}
|
|
17442
18211
|
}
|
|
17443
|
-
const bot = karin$1.getBot(botId);
|
|
17444
|
-
const forwardMsg = common.makeForward(imageres, botId, bot.account.name);
|
|
17445
|
-
await bot.sendForwardMsg(Contact, forwardMsg);
|
|
17446
18212
|
}
|
|
17447
18213
|
}
|
|
17448
18214
|
}
|
|
17449
|
-
if (skip ||
|
|
18215
|
+
if (skip || pushItem.pushType !== "live" && status.message_id) await douyinDBInstance.addAwemeCache(actualAwemeId, pushItem.sec_uid, groupId, pushItem.pushType);
|
|
17450
18216
|
} catch (error) {
|
|
17451
18217
|
throw new Error(`${error}`);
|
|
17452
18218
|
}
|
|
@@ -17460,11 +18226,8 @@ var DouYinpush = class extends Base {
|
|
|
17460
18226
|
for (const item of filteredUserList) {
|
|
17461
18227
|
await common.sleep(2e3);
|
|
17462
18228
|
const sec_uid = item.sec_uid;
|
|
17463
|
-
|
|
17464
|
-
|
|
17465
|
-
sec_uid,
|
|
17466
|
-
typeMode: "strict"
|
|
17467
|
-
});
|
|
18229
|
+
const pushTypes = item.pushTypes || ["post"];
|
|
18230
|
+
logger.debug(`开始获取用户:${item.remark}(${sec_uid})的内容,推送类型:${pushTypes.join(", ")}`);
|
|
17468
18231
|
const userinfo = await this.amagi.douyin.fetcher.fetchUserProfile({
|
|
17469
18232
|
sec_uid,
|
|
17470
18233
|
typeMode: "strict"
|
|
@@ -17481,74 +18244,73 @@ var DouYinpush = class extends Base {
|
|
|
17481
18244
|
logger.warn(`${item.remark}(${sec_uid})${userinfo.data.user.special_state_info.title}`);
|
|
17482
18245
|
continue;
|
|
17483
18246
|
}
|
|
17484
|
-
|
|
17485
|
-
|
|
17486
|
-
|
|
17487
|
-
|
|
17488
|
-
|
|
17489
|
-
|
|
17490
|
-
|
|
17491
|
-
|
|
17492
|
-
|
|
17493
|
-
|
|
18247
|
+
for (const pushType of pushTypes) {
|
|
18248
|
+
await common.sleep(1e3);
|
|
18249
|
+
if (pushType === "live") {
|
|
18250
|
+
const liveItem = await processLiveStream(sec_uid, userinfo, item, targets, this.amagi);
|
|
18251
|
+
if (liveItem) willbepushlist[`live_${sec_uid}`] = liveItem;
|
|
18252
|
+
continue;
|
|
18253
|
+
}
|
|
18254
|
+
let contentList = [];
|
|
18255
|
+
let listName = "";
|
|
18256
|
+
switch (pushType) {
|
|
18257
|
+
case "post":
|
|
18258
|
+
listName = "作品列表";
|
|
18259
|
+
contentList = (await this.amagi.douyin.fetcher.fetchUserVideoList({
|
|
18260
|
+
sec_uid,
|
|
18261
|
+
number: 5,
|
|
18262
|
+
typeMode: "strict"
|
|
18263
|
+
})).data.aweme_list || [];
|
|
18264
|
+
break;
|
|
18265
|
+
case "favorite":
|
|
18266
|
+
listName = "喜欢列表";
|
|
18267
|
+
const favoritelist = await this.amagi.douyin.fetcher.fetchUserFavoriteList({
|
|
18268
|
+
sec_uid,
|
|
18269
|
+
number: 5,
|
|
18270
|
+
typeMode: "strict"
|
|
18271
|
+
});
|
|
18272
|
+
if (favoritelist.data.aweme_list.length === 0) logger.warn(`${item.remark}(${item.short_id}) 获取到的喜欢列表数量为零!此博主可能未公开他/她的喜欢列表`);
|
|
18273
|
+
contentList = favoritelist.data.aweme_list || [];
|
|
18274
|
+
break;
|
|
18275
|
+
case "recommend":
|
|
18276
|
+
listName = "推荐列表";
|
|
18277
|
+
const recommendlist = await this.amagi.douyin.fetcher.fetchUserRecommendList({
|
|
18278
|
+
sec_uid,
|
|
18279
|
+
number: 5,
|
|
18280
|
+
typeMode: "strict"
|
|
18281
|
+
});
|
|
18282
|
+
if (recommendlist.data.aweme_list.length === 0) logger.warn(`${item.remark}(${item.short_id}) 获取到的推荐列表数量为零!此博主可能未公开他/她的推荐列表`);
|
|
18283
|
+
contentList = recommendlist.data.aweme_list || [];
|
|
18284
|
+
break;
|
|
18285
|
+
}
|
|
18286
|
+
logger.debug(`获取到 ${item.remark} 的${listName},共 ${contentList.length} 条`);
|
|
18287
|
+
if (contentList.length > 0) {
|
|
18288
|
+
let pushItems = [];
|
|
18289
|
+
switch (pushType) {
|
|
18290
|
+
case "post":
|
|
18291
|
+
pushItems = await processPostList(contentList, sec_uid, userinfo, item, targets);
|
|
18292
|
+
break;
|
|
18293
|
+
case "favorite":
|
|
18294
|
+
pushItems = await processFavoriteList(contentList, sec_uid, userinfo, item, targets, this.force);
|
|
18295
|
+
break;
|
|
18296
|
+
case "recommend":
|
|
18297
|
+
pushItems = await processRecommendList(contentList, sec_uid, userinfo, item, targets, this.force);
|
|
18298
|
+
break;
|
|
18299
|
+
}
|
|
18300
|
+
for (const pushItem of pushItems) {
|
|
18301
|
+
const key = `${pushType}_${pushItem.Detail_Data.aweme_id}`;
|
|
18302
|
+
willbepushlist[key] = pushItem;
|
|
18303
|
+
}
|
|
17494
18304
|
}
|
|
17495
|
-
if (shouldPush) willbepushlist[aweme.aweme_id] = {
|
|
17496
|
-
remark: item.remark,
|
|
17497
|
-
sec_uid,
|
|
17498
|
-
create_time: aweme.create_time,
|
|
17499
|
-
targets,
|
|
17500
|
-
Detail_Data: {
|
|
17501
|
-
...aweme,
|
|
17502
|
-
user_info: userinfo
|
|
17503
|
-
},
|
|
17504
|
-
avatar_img: "https://p3-pc.douyinpic.com/aweme/1080x1080/" + userinfo.data.user.avatar_larger.uri,
|
|
17505
|
-
living: false
|
|
17506
|
-
};
|
|
17507
|
-
}
|
|
17508
|
-
const liveStatus = await douyinDBInstance.getLiveStatus(sec_uid);
|
|
17509
|
-
if (userinfo.data.user.live_status === 1) {
|
|
17510
|
-
const UserInfoData = await this.amagi.douyin.fetcher.fetchUserProfile({
|
|
17511
|
-
sec_uid: userinfo.data.user.sec_uid,
|
|
17512
|
-
typeMode: "strict"
|
|
17513
|
-
});
|
|
17514
|
-
if (!UserInfoData.data.user?.live_status || UserInfoData.data.user.live_status !== 1) logger.error((UserInfoData?.data?.user?.nickname ?? "用户") + "当前未在直播");
|
|
17515
|
-
if (!UserInfoData.data.user.room_data) logger.error("未获取到直播间信息!");
|
|
17516
|
-
const room_data = JSON.parse(UserInfoData.data.user.room_data);
|
|
17517
|
-
const liveInfo = await this.amagi.douyin.fetcher.fetchLiveRoomInfo({
|
|
17518
|
-
room_id: UserInfoData.data.user.room_id_str,
|
|
17519
|
-
web_rid: room_data.owner.web_rid,
|
|
17520
|
-
typeMode: "strict"
|
|
17521
|
-
});
|
|
17522
|
-
if (!liveStatus.living) willbepushlist[`live_${sec_uid}`] = {
|
|
17523
|
-
remark: item.remark,
|
|
17524
|
-
sec_uid,
|
|
17525
|
-
create_time: Date.now(),
|
|
17526
|
-
targets,
|
|
17527
|
-
Detail_Data: {
|
|
17528
|
-
user_info: userinfo,
|
|
17529
|
-
room_data: JSON.parse(userinfo.data.user.room_data),
|
|
17530
|
-
live_data: liveInfo,
|
|
17531
|
-
liveStatus: {
|
|
17532
|
-
liveStatus: "open",
|
|
17533
|
-
isChanged: true,
|
|
17534
|
-
isliving: true
|
|
17535
|
-
}
|
|
17536
|
-
},
|
|
17537
|
-
avatar_img: "https://p3-pc.douyinpic.com/aweme/1080x1080/" + userinfo.data.user.avatar_larger.uri,
|
|
17538
|
-
living: true
|
|
17539
|
-
};
|
|
17540
|
-
} else if (liveStatus.living) {
|
|
17541
|
-
await douyinDBInstance.updateLiveStatus(sec_uid, false);
|
|
17542
|
-
logger.info(`用户 ${item.remark ?? sec_uid} 已关播,更新直播状态`);
|
|
17543
18305
|
}
|
|
17544
18306
|
}
|
|
17545
18307
|
} catch (error) {
|
|
17546
|
-
throw new Error(
|
|
18308
|
+
throw new Error(`获取抖音用户内容列表失败: ${error}`);
|
|
17547
18309
|
}
|
|
17548
18310
|
return willbepushlist;
|
|
17549
18311
|
}
|
|
17550
|
-
async checkIfAlreadyPushed(aweme_id, sec_uid, groupIds) {
|
|
17551
|
-
for (const groupId of groupIds) if (!await douyinDBInstance.isAwemePushed(aweme_id, sec_uid, groupId)) return false;
|
|
18312
|
+
async checkIfAlreadyPushed(aweme_id, sec_uid, groupIds, pushType = "post") {
|
|
18313
|
+
for (const groupId of groupIds) if (!await douyinDBInstance.isAwemePushed(aweme_id, sec_uid, groupId, pushType)) return false;
|
|
17552
18314
|
return true;
|
|
17553
18315
|
}
|
|
17554
18316
|
async setting(data$1) {
|
|
@@ -17593,6 +18355,12 @@ var DouYinpush = class extends Base {
|
|
|
17593
18355
|
}
|
|
17594
18356
|
} else {
|
|
17595
18357
|
existingItem.group_id.push(`${groupId}:${botId}`);
|
|
18358
|
+
if (!existingItem.pushTypes || existingItem.pushTypes.length === 0) existingItem.pushTypes = [
|
|
18359
|
+
"post",
|
|
18360
|
+
"live",
|
|
18361
|
+
"favorite",
|
|
18362
|
+
"recommend"
|
|
18363
|
+
];
|
|
17596
18364
|
if (!isSubscribed) await douyinDBInstance.subscribeDouyinUser(groupId, botId, sec_uid, user_shortid, UserInfoData.data.user.nickname);
|
|
17597
18365
|
await this.e.reply(`群:${groupInfo.groupName}(${groupId})\n添加成功!${UserInfoData.data.user.nickname}\n抖音号:${user_shortid}`);
|
|
17598
18366
|
if (Config.douyin.push.switch === false) await this.e.reply("请发送「#设置抖音推送开启」以进行推送");
|
|
@@ -17604,7 +18372,13 @@ var DouYinpush = class extends Base {
|
|
|
17604
18372
|
sec_uid,
|
|
17605
18373
|
group_id: [`${groupId}:${botId}`],
|
|
17606
18374
|
remark: UserInfoData.data.user.nickname,
|
|
17607
|
-
short_id: user_shortid
|
|
18375
|
+
short_id: user_shortid,
|
|
18376
|
+
pushTypes: [
|
|
18377
|
+
"post",
|
|
18378
|
+
"live",
|
|
18379
|
+
"favorite",
|
|
18380
|
+
"recommend"
|
|
18381
|
+
]
|
|
17608
18382
|
});
|
|
17609
18383
|
if (!isSubscribed) await douyinDBInstance.subscribeDouyinUser(groupId, botId, sec_uid, user_shortid, UserInfoData.data.user.nickname);
|
|
17610
18384
|
await this.e.reply(`群:${groupInfo.groupName}(${groupId})\n添加成功!${UserInfoData.data.user.nickname}\n抖音号:${user_shortid}`);
|
|
@@ -17632,7 +18406,9 @@ var DouYinpush = class extends Base {
|
|
|
17632
18406
|
sec_uid,
|
|
17633
18407
|
typeMode: "strict"
|
|
17634
18408
|
});
|
|
17635
|
-
const
|
|
18409
|
+
const configItem = Config.pushlist.douyin?.find((item) => item.sec_uid === sec_uid);
|
|
18410
|
+
const switchStatus = configItem?.switch !== false;
|
|
18411
|
+
const pushTypes = configItem?.pushTypes || ["post"];
|
|
17636
18412
|
renderOpt.push({
|
|
17637
18413
|
avatar_img: userInfo.data.user.avatar_larger.url_list[0],
|
|
17638
18414
|
username: userInfo.data.user.nickname,
|
|
@@ -17640,7 +18416,8 @@ var DouYinpush = class extends Base {
|
|
|
17640
18416
|
fans: this.count(userInfo.data.user.follower_count),
|
|
17641
18417
|
total_favorited: this.count(userInfo.data.user.total_favorited),
|
|
17642
18418
|
following_count: this.count(userInfo.data.user.following_count),
|
|
17643
|
-
switch: switchStatus
|
|
18419
|
+
switch: switchStatus,
|
|
18420
|
+
pushTypes
|
|
17644
18421
|
});
|
|
17645
18422
|
}
|
|
17646
18423
|
const img$2 = await Render("douyin/userlist", {
|