This commit is contained in:
lovebird 2025-03-11 11:27:54 +01:00
parent 3a6b788e58
commit d50d9d9f04
9 changed files with 2180 additions and 923 deletions

View File

@ -80,7 +80,7 @@
},
"../../node_modules/.pnpm/@vercel+style-guide@5.2.0_eslint@8.57.1_prettier@3.2.5_typescript@5.7.3/node_modules/@vercel/style-guide": {
"version": "5.2.0",
"dev": true,
"extraneous": true,
"license": "MPL-2.0",
"dependencies": {
"@babel/core": "^7.22.11",
@ -140,7 +140,7 @@
},
"../../node_modules/.pnpm/eslint-config-turbo@2.0.0_eslint@8.57.1/node_modules/eslint-config-turbo": {
"version": "2.0.0",
"dev": true,
"extraneous": true,
"license": "MIT",
"dependencies": {
"eslint-plugin-turbo": "2.0.0"
@ -233,7 +233,7 @@
},
"../../node_modules/.pnpm/eslint-plugin-mdx@3.1.5_eslint@8.57.1/node_modules/eslint-plugin-mdx": {
"version": "3.1.5",
"dev": true,
"extraneous": true,
"license": "MIT",
"dependencies": {
"eslint-mdx": "^3.1.5",
@ -258,7 +258,7 @@
},
"../../node_modules/.pnpm/eslint-plugin-only-warn@1.1.0/node_modules/eslint-plugin-only-warn": {
"version": "1.1.0",
"dev": true,
"extraneous": true,
"license": "MIT",
"devDependencies": {
"eslint": "^7.31.0",
@ -349,7 +349,7 @@
},
"../../node_modules/.pnpm/eslint-plugin-storybook@0.8.0_eslint@8.57.1_typescript@5.7.3/node_modules/eslint-plugin-storybook": {
"version": "0.8.0",
"dev": true,
"extraneous": true,
"license": "MIT",
"dependencies": {
"@storybook/csf": "^0.0.1",
@ -2094,7 +2094,7 @@
"../eslint-config": {
"name": "@repo/eslint-config",
"version": "0.0.0",
"dev": true,
"extraneous": true,
"devDependencies": {
"@vercel/style-guide": "^5.2.0",
"eslint-config-turbo": "^2.0.0",
@ -2103,26 +2103,6 @@
"eslint-plugin-storybook": "^0.8.0"
}
},
"../eslint-config/node_modules/@vercel/style-guide": {
"resolved": "../../node_modules/.pnpm/@vercel+style-guide@5.2.0_eslint@8.57.1_prettier@3.2.5_typescript@5.7.3/node_modules/@vercel/style-guide",
"link": true
},
"../eslint-config/node_modules/eslint-config-turbo": {
"resolved": "../../node_modules/.pnpm/eslint-config-turbo@2.0.0_eslint@8.57.1/node_modules/eslint-config-turbo",
"link": true
},
"../eslint-config/node_modules/eslint-plugin-mdx": {
"resolved": "../../node_modules/.pnpm/eslint-plugin-mdx@3.1.5_eslint@8.57.1/node_modules/eslint-plugin-mdx",
"link": true
},
"../eslint-config/node_modules/eslint-plugin-only-warn": {
"resolved": "../../node_modules/.pnpm/eslint-plugin-only-warn@1.1.0/node_modules/eslint-plugin-only-warn",
"link": true
},
"../eslint-config/node_modules/eslint-plugin-storybook": {
"resolved": "../../node_modules/.pnpm/eslint-plugin-storybook@0.8.0_eslint@8.57.1_typescript@5.7.3/node_modules/eslint-plugin-storybook",
"link": true
},
"../fs": {
"name": "@polymech/fs",
"version": "0.13.41",
@ -3081,15 +3061,14 @@
"version": "0.2.6",
"license": "BSD",
"dependencies": {
"@polymech/core": "link:..\\core",
"@polymech/core": "file:../core",
"@repo/typescript-config": "file:../typescript-config",
"tslog": "^3.3.3",
"tsup": "^8.3.5",
"zod": "^3.24.1"
},
"devDependencies": {
"@eslint/js": "^9.18.0",
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/node": "^22.10.9",
"eslint": "^8.57.1",
"eslint-plugin-import": "^2.31.0",
@ -3107,10 +3086,6 @@
"resolved": "../core",
"link": true
},
"../log/node_modules/@repo/eslint-config": {
"resolved": "../eslint-config",
"link": true
},
"../log/node_modules/@repo/typescript-config": {
"resolved": "../typescript-config",
"link": true

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@
"zod": "3.24.2"
},
"bin": {
"kbot-d": "main.js"
"kbot-d": "dist-in/main.js"
},
"devDependencies": {
"@repo/typescript-config": "file:../typescript-config",
@ -62,14 +62,14 @@
"@polymech/log": "file:../log",
"axios": "^1.7.9",
"cheerio": "^1.0.0",
"find-up": "^5.0.0",
"find-up": "^7.0.0",
"glob": "^11.0.1",
"inquirer": "^12.2.0",
"jsdom": "^25.0.1",
"marked": "^15.0.4",
"mime-types": "^2.1.35",
"nodemailer": "^6.9.16",
"openai": "^4.84.0",
"openai": "^4.85.3",
"p-map": "^7.0.3",
"rotating-file-stream": "^3.2.6",
"screenshot-desktop": "^1.15.0",
@ -149,7 +149,8 @@
"version": "0.13.41",
"license": "BSD-3-Clause",
"dependencies": {
"@polymech/core": "link:..\\core",
"@polymech/core": "file:../core",
"@repo/typescript-config": "file:../typescript-config",
"denodeify": "^1.2.1",
"glob": "^10.4.1",
"mime": "^2.0.3",
@ -161,10 +162,8 @@
"yargs": "^17.7.2"
},
"devDependencies": {
"@repo/typescript-config": "workspace:*",
"@types/denodeify": "^1.2.31",
"@types/mime": "^2.0.0",
"@types/mkdirp": "^0.5.1",
"@types/node": "^22.10.2",
"fs-extra": "^4.0.2",
"globals": "^15.14.0",
@ -180,15 +179,14 @@
"version": "0.2.6",
"license": "BSD",
"dependencies": {
"@polymech/core": "link:..\\core",
"@polymech/core": "file:../core",
"@repo/typescript-config": "file:../typescript-config",
"tslog": "^3.3.3",
"tsup": "^8.3.5",
"zod": "^3.24.1"
},
"devDependencies": {
"@eslint/js": "^9.18.0",
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/node": "^22.10.9",
"eslint": "^8.57.1",
"eslint-plugin-import": "^2.31.0",

View File

@ -35,12 +35,9 @@ export declare const YtDlpOptionsSchema: z.ZodObject<{
userAgent: z.ZodOptional<z.ZodString>;
extraArgs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, "strip", z.ZodTypeAny, {
format?: string | undefined;
output?: string | undefined;
quiet?: boolean | undefined;
verbose?: boolean | undefined;
audioFormat?: "mp3" | "best" | "aac" | "flac" | "m4a" | "opus" | "vorbis" | "wav" | undefined;
executablePath?: string | undefined;
output?: string | undefined;
format?: string | undefined;
formatSort?: string | undefined;
mergeOutputFormat?: "mp4" | "flv" | "webm" | "mkv" | "avi" | undefined;
limit?: number | undefined;
@ -60,9 +57,12 @@ export declare const YtDlpOptionsSchema: z.ZodObject<{
playlistEnd?: number | undefined;
playlistItems?: string | undefined;
extractAudio?: boolean | undefined;
audioFormat?: "best" | "aac" | "flac" | "mp3" | "m4a" | "opus" | "vorbis" | "wav" | undefined;
audioQuality?: string | undefined;
remuxVideo?: "mp4" | "flv" | "webm" | "mkv" | "avi" | "mov" | undefined;
recodeVideo?: "mp4" | "flv" | "webm" | "mkv" | "avi" | undefined;
quiet?: boolean | undefined;
verbose?: boolean | undefined;
noWarnings?: boolean | undefined;
simulate?: boolean | undefined;
noCheckCertificates?: boolean | undefined;
@ -70,12 +70,9 @@ export declare const YtDlpOptionsSchema: z.ZodObject<{
userAgent?: string | undefined;
extraArgs?: string[] | undefined;
}, {
format?: string | undefined;
output?: string | undefined;
quiet?: boolean | undefined;
verbose?: boolean | undefined;
audioFormat?: "mp3" | "best" | "aac" | "flac" | "m4a" | "opus" | "vorbis" | "wav" | undefined;
executablePath?: string | undefined;
output?: string | undefined;
format?: string | undefined;
formatSort?: string | undefined;
mergeOutputFormat?: "mp4" | "flv" | "webm" | "mkv" | "avi" | undefined;
limit?: number | undefined;
@ -95,9 +92,12 @@ export declare const YtDlpOptionsSchema: z.ZodObject<{
playlistEnd?: number | undefined;
playlistItems?: string | undefined;
extractAudio?: boolean | undefined;
audioFormat?: "best" | "aac" | "flac" | "mp3" | "m4a" | "opus" | "vorbis" | "wav" | undefined;
audioQuality?: string | undefined;
remuxVideo?: "mp4" | "flv" | "webm" | "mkv" | "avi" | "mov" | undefined;
recodeVideo?: "mp4" | "flv" | "webm" | "mkv" | "avi" | undefined;
quiet?: boolean | undefined;
verbose?: boolean | undefined;
noWarnings?: boolean | undefined;
simulate?: boolean | undefined;
noCheckCertificates?: boolean | undefined;
@ -192,12 +192,12 @@ export declare const VideoInfoSchema: z.ZodObject<{
tbr?: number | undefined;
}[];
webpage_url: string;
description?: string | undefined;
thumbnails?: {
url: string;
height?: number | undefined;
width?: number | undefined;
}[] | undefined;
description?: string | undefined;
upload_date?: string | undefined;
uploader?: string | undefined;
uploader_id?: string | undefined;
@ -232,12 +232,12 @@ export declare const VideoInfoSchema: z.ZodObject<{
tbr?: number | undefined;
}[];
webpage_url: string;
description?: string | undefined;
thumbnails?: {
url: string;
height?: number | undefined;
width?: number | undefined;
}[] | undefined;
description?: string | undefined;
upload_date?: string | undefined;
uploader?: string | undefined;
uploader_id?: string | undefined;
@ -345,12 +345,12 @@ export declare const DownloadResultSchema: z.ZodObject<{
tbr?: number | undefined;
}[];
webpage_url: string;
description?: string | undefined;
thumbnails?: {
url: string;
height?: number | undefined;
width?: number | undefined;
}[] | undefined;
description?: string | undefined;
upload_date?: string | undefined;
uploader?: string | undefined;
uploader_id?: string | undefined;
@ -385,12 +385,12 @@ export declare const DownloadResultSchema: z.ZodObject<{
tbr?: number | undefined;
}[];
webpage_url: string;
description?: string | undefined;
thumbnails?: {
url: string;
height?: number | undefined;
width?: number | undefined;
}[] | undefined;
description?: string | undefined;
upload_date?: string | undefined;
uploader?: string | undefined;
uploader_id?: string | undefined;
@ -433,12 +433,12 @@ export declare const DownloadResultSchema: z.ZodObject<{
tbr?: number | undefined;
}[];
webpage_url: string;
description?: string | undefined;
thumbnails?: {
url: string;
height?: number | undefined;
width?: number | undefined;
}[] | undefined;
description?: string | undefined;
upload_date?: string | undefined;
uploader?: string | undefined;
uploader_id?: string | undefined;
@ -460,10 +460,10 @@ export declare const DownloadResultSchema: z.ZodObject<{
};
filePath: string;
success: boolean;
error?: string | undefined;
downloadedBytes?: number | undefined;
elapsedTime?: number | undefined;
averageSpeed?: number | undefined;
error?: string | undefined;
}, {
videoInfo: {
id: string;
@ -481,12 +481,12 @@ export declare const DownloadResultSchema: z.ZodObject<{
tbr?: number | undefined;
}[];
webpage_url: string;
description?: string | undefined;
thumbnails?: {
url: string;
height?: number | undefined;
width?: number | undefined;
}[] | undefined;
description?: string | undefined;
upload_date?: string | undefined;
uploader?: string | undefined;
uploader_id?: string | undefined;
@ -508,10 +508,10 @@ export declare const DownloadResultSchema: z.ZodObject<{
};
filePath: string;
success: boolean;
error?: string | undefined;
downloadedBytes?: number | undefined;
elapsedTime?: number | undefined;
averageSpeed?: number | undefined;
error?: string | undefined;
}>;
export type DownloadResult = z.infer<typeof DownloadResultSchema>;
export declare const CommandResultSchema: z.ZodObject<{
@ -521,15 +521,15 @@ export declare const CommandResultSchema: z.ZodObject<{
success: z.ZodBoolean;
exitCode: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
stdout: string;
success: boolean;
command: string;
stdout: string;
stderr: string;
exitCode: number;
}, {
stdout: string;
success: boolean;
command: string;
stdout: string;
stderr: string;
exitCode: number;
}>;
@ -576,13 +576,13 @@ export declare const YtDlpErrorSchema: z.ZodObject<{
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
command: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
type: YtDlpErrorType;
message: string;
type: YtDlpErrorType;
command?: string | undefined;
details?: Record<string, any> | undefined;
}, {
type: YtDlpErrorType;
message: string;
type: YtDlpErrorType;
command?: string | undefined;
details?: Record<string, any> | undefined;
}>;
@ -599,20 +599,20 @@ export declare const DownloadOptionsSchema: z.ZodObject<{
additionalArgs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, "strip", z.ZodTypeAny, {
format?: string | undefined;
audioFormat?: string | undefined;
outputDir?: string | undefined;
outputTemplate?: string | undefined;
audioOnly?: boolean | undefined;
audioFormat?: string | undefined;
subtitles?: boolean | string[] | undefined;
maxFileSize?: number | undefined;
rateLimit?: string | undefined;
additionalArgs?: string[] | undefined;
}, {
format?: string | undefined;
audioFormat?: string | undefined;
outputDir?: string | undefined;
outputTemplate?: string | undefined;
audioOnly?: boolean | undefined;
audioFormat?: string | undefined;
subtitles?: boolean | string[] | undefined;
maxFileSize?: number | undefined;
rateLimit?: string | undefined;
@ -663,11 +663,11 @@ export declare const VideoFormatSchema: z.ZodObject<{
protocol: string;
vcodec: string;
acodec: string;
url?: string | undefined;
resolution?: string | undefined;
fps?: number | undefined;
filesize?: number | undefined;
tbr?: number | undefined;
url?: string | undefined;
height?: number | undefined;
width?: number | undefined;
format_note?: string | undefined;
@ -681,11 +681,11 @@ export declare const VideoFormatSchema: z.ZodObject<{
protocol: string;
vcodec: string;
acodec: string;
url?: string | undefined;
resolution?: string | undefined;
fps?: number | undefined;
filesize?: number | undefined;
tbr?: number | undefined;
url?: string | undefined;
height?: number | undefined;
width?: number | undefined;
format_note?: string | undefined;
@ -694,4 +694,379 @@ export declare const VideoFormatSchema: z.ZodObject<{
preference?: number | undefined;
}>;
export type VideoFormat = z.infer<typeof VideoFormatSchema>;
export declare const TikTokMetadataOptionsSchema: z.ZodObject<{
url: z.ZodString;
outputPath: z.ZodString;
format: z.ZodDefault<z.ZodOptional<z.ZodEnum<["json", "pretty"]>>>;
includeComments: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
userAgent: z.ZodOptional<z.ZodString>;
proxy: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
format: "json" | "pretty";
url: string;
outputPath: string;
includeComments: boolean;
timeout: number;
userAgent?: string | undefined;
proxy?: string | undefined;
}, {
url: string;
outputPath: string;
format?: "json" | "pretty" | undefined;
userAgent?: string | undefined;
includeComments?: boolean | undefined;
timeout?: number | undefined;
proxy?: string | undefined;
}>;
export type TikTokMetadataOptions = z.infer<typeof TikTokMetadataOptionsSchema>;
export declare const TikTokMetadataSchema: z.ZodObject<{
id: z.ZodString;
url: z.ZodString;
timestamp: z.ZodNumber;
scrapedAt: z.ZodString;
author: z.ZodObject<{
id: z.ZodString;
uniqueId: z.ZodString;
nickname: z.ZodString;
avatarUrl: z.ZodOptional<z.ZodString>;
verified: z.ZodOptional<z.ZodBoolean>;
secUid: z.ZodOptional<z.ZodString>;
following: z.ZodOptional<z.ZodNumber>;
followers: z.ZodOptional<z.ZodNumber>;
likes: z.ZodOptional<z.ZodNumber>;
profileUrl: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
id: string;
uniqueId: string;
nickname: string;
avatarUrl?: string | undefined;
verified?: boolean | undefined;
secUid?: string | undefined;
following?: number | undefined;
followers?: number | undefined;
likes?: number | undefined;
profileUrl?: string | undefined;
}, {
id: string;
uniqueId: string;
nickname: string;
avatarUrl?: string | undefined;
verified?: boolean | undefined;
secUid?: string | undefined;
following?: number | undefined;
followers?: number | undefined;
likes?: number | undefined;
profileUrl?: string | undefined;
}>;
video: z.ZodObject<{
id: z.ZodString;
description: z.ZodString;
createTime: z.ZodNumber;
width: z.ZodNumber;
height: z.ZodNumber;
duration: z.ZodNumber;
ratio: z.ZodOptional<z.ZodString>;
coverUrl: z.ZodOptional<z.ZodString>;
playUrl: z.ZodOptional<z.ZodString>;
downloadUrl: z.ZodOptional<z.ZodString>;
shareCount: z.ZodOptional<z.ZodNumber>;
commentCount: z.ZodOptional<z.ZodNumber>;
likeCount: z.ZodOptional<z.ZodNumber>;
viewCount: z.ZodOptional<z.ZodNumber>;
hashTags: z.ZodOptional<z.ZodArray<z.ZodObject<{
id: z.ZodString;
name: z.ZodString;
title: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
id: string;
name: string;
title?: string | undefined;
}, {
id: string;
name: string;
title?: string | undefined;
}>, "many">>;
mentions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
musicInfo: z.ZodOptional<z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
title: z.ZodOptional<z.ZodString>;
authorName: z.ZodOptional<z.ZodString>;
coverUrl: z.ZodOptional<z.ZodString>;
playUrl: z.ZodOptional<z.ZodString>;
duration: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
id?: string | undefined;
title?: string | undefined;
duration?: number | undefined;
coverUrl?: string | undefined;
playUrl?: string | undefined;
authorName?: string | undefined;
}, {
id?: string | undefined;
title?: string | undefined;
duration?: number | undefined;
coverUrl?: string | undefined;
playUrl?: string | undefined;
authorName?: string | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
id: string;
height: number;
width: number;
description: string;
duration: number;
createTime: number;
ratio?: string | undefined;
coverUrl?: string | undefined;
playUrl?: string | undefined;
downloadUrl?: string | undefined;
shareCount?: number | undefined;
commentCount?: number | undefined;
likeCount?: number | undefined;
viewCount?: number | undefined;
hashTags?: {
id: string;
name: string;
title?: string | undefined;
}[] | undefined;
mentions?: string[] | undefined;
musicInfo?: {
id?: string | undefined;
title?: string | undefined;
duration?: number | undefined;
coverUrl?: string | undefined;
playUrl?: string | undefined;
authorName?: string | undefined;
} | undefined;
}, {
id: string;
height: number;
width: number;
description: string;
duration: number;
createTime: number;
ratio?: string | undefined;
coverUrl?: string | undefined;
playUrl?: string | undefined;
downloadUrl?: string | undefined;
shareCount?: number | undefined;
commentCount?: number | undefined;
likeCount?: number | undefined;
viewCount?: number | undefined;
hashTags?: {
id: string;
name: string;
title?: string | undefined;
}[] | undefined;
mentions?: string[] | undefined;
musicInfo?: {
id?: string | undefined;
title?: string | undefined;
duration?: number | undefined;
coverUrl?: string | undefined;
playUrl?: string | undefined;
authorName?: string | undefined;
} | undefined;
}>;
comments: z.ZodOptional<z.ZodArray<z.ZodObject<{
id: z.ZodString;
text: z.ZodString;
createTime: z.ZodNumber;
likeCount: z.ZodNumber;
authorId: z.ZodString;
authorName: z.ZodString;
authorAvatar: z.ZodOptional<z.ZodString>;
replies: z.ZodOptional<z.ZodArray<z.ZodObject<{
id: z.ZodString;
text: z.ZodString;
createTime: z.ZodNumber;
likeCount: z.ZodNumber;
authorId: z.ZodString;
authorName: z.ZodString;
authorAvatar: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
id: string;
createTime: number;
likeCount: number;
authorName: string;
text: string;
authorId: string;
authorAvatar?: string | undefined;
}, {
id: string;
createTime: number;
likeCount: number;
authorName: string;
text: string;
authorId: string;
authorAvatar?: string | undefined;
}>, "many">>;
}, "strip", z.ZodTypeAny, {
id: string;
createTime: number;
likeCount: number;
authorName: string;
text: string;
authorId: string;
authorAvatar?: string | undefined;
replies?: {
id: string;
createTime: number;
likeCount: number;
authorName: string;
text: string;
authorId: string;
authorAvatar?: string | undefined;
}[] | undefined;
}, {
id: string;
createTime: number;
likeCount: number;
authorName: string;
text: string;
authorId: string;
authorAvatar?: string | undefined;
replies?: {
id: string;
createTime: number;
likeCount: number;
authorName: string;
text: string;
authorId: string;
authorAvatar?: string | undefined;
}[] | undefined;
}>, "many">>;
}, "strip", z.ZodTypeAny, {
id: string;
url: string;
timestamp: number;
scrapedAt: string;
author: {
id: string;
uniqueId: string;
nickname: string;
avatarUrl?: string | undefined;
verified?: boolean | undefined;
secUid?: string | undefined;
following?: number | undefined;
followers?: number | undefined;
likes?: number | undefined;
profileUrl?: string | undefined;
};
video: {
id: string;
height: number;
width: number;
description: string;
duration: number;
createTime: number;
ratio?: string | undefined;
coverUrl?: string | undefined;
playUrl?: string | undefined;
downloadUrl?: string | undefined;
shareCount?: number | undefined;
commentCount?: number | undefined;
likeCount?: number | undefined;
viewCount?: number | undefined;
hashTags?: {
id: string;
name: string;
title?: string | undefined;
}[] | undefined;
mentions?: string[] | undefined;
musicInfo?: {
id?: string | undefined;
title?: string | undefined;
duration?: number | undefined;
coverUrl?: string | undefined;
playUrl?: string | undefined;
authorName?: string | undefined;
} | undefined;
};
comments?: {
id: string;
createTime: number;
likeCount: number;
authorName: string;
text: string;
authorId: string;
authorAvatar?: string | undefined;
replies?: {
id: string;
createTime: number;
likeCount: number;
authorName: string;
text: string;
authorId: string;
authorAvatar?: string | undefined;
}[] | undefined;
}[] | undefined;
}, {
id: string;
url: string;
timestamp: number;
scrapedAt: string;
author: {
id: string;
uniqueId: string;
nickname: string;
avatarUrl?: string | undefined;
verified?: boolean | undefined;
secUid?: string | undefined;
following?: number | undefined;
followers?: number | undefined;
likes?: number | undefined;
profileUrl?: string | undefined;
};
video: {
id: string;
height: number;
width: number;
description: string;
duration: number;
createTime: number;
ratio?: string | undefined;
coverUrl?: string | undefined;
playUrl?: string | undefined;
downloadUrl?: string | undefined;
shareCount?: number | undefined;
commentCount?: number | undefined;
likeCount?: number | undefined;
viewCount?: number | undefined;
hashTags?: {
id: string;
name: string;
title?: string | undefined;
}[] | undefined;
mentions?: string[] | undefined;
musicInfo?: {
id?: string | undefined;
title?: string | undefined;
duration?: number | undefined;
coverUrl?: string | undefined;
playUrl?: string | undefined;
authorName?: string | undefined;
} | undefined;
};
comments?: {
id: string;
createTime: number;
likeCount: number;
authorName: string;
text: string;
authorId: string;
authorAvatar?: string | undefined;
replies?: {
id: string;
createTime: number;
likeCount: number;
authorName: string;
text: string;
authorId: string;
authorAvatar?: string | undefined;
}[] | undefined;
}[] | undefined;
}>;
export type TikTokMetadata = z.infer<typeof TikTokMetadataSchema>;
//# sourceMappingURL=types.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0D7B,CAAC;AAGH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAG9D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4C1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAA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BAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkB5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAG5D,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;EAQtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAGhF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuE/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}

File diff suppressed because it is too large Load Diff

View File

@ -37,6 +37,7 @@
"dependencies": {
"@types/node": "^22.13.10",
"@types/yargs": "^17.0.33",
"puppeteer": "^24.4.0",
"ts-node": "^10.9.2",
"tslog": "^4.9.3",
"typescript": "^5.8.2",

View File

@ -3,11 +3,12 @@ import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import { YtDlp } from './ytdlp.js';
import { logger } from './logger.js';
import { FormatOptionsSchema, VideoInfoOptionsSchema, DownloadOptionsSchema } from './types.js';
import { FormatOptionsSchema, VideoInfoOptionsSchema, DownloadOptionsSchema, TikTokMetadataOptionsSchema } from './types.js';
import { z } from 'zod';
import { exec } from 'node:child_process';
import { promisify } from 'node:util';
const execAsync = promisify(exec);
const ytdlp = new YtDlp();
@ -20,9 +21,10 @@ function printHelp() {
console.log(" ytdlp-ts <command> [options] <url>\n");
console.log("COMMANDS:");
console.log(" download [url] Download a video from the specified URL");
console.log(" info [url] Get information about a video");
console.log(" formats [url] List available formats for a video\n");
console.log(" download [url] Download a video from the specified URL");
console.log(" info [url] Get information about a video");
console.log(" formats [url] List available formats for a video");
console.log(" tiktok:meta [url] Scrape metadata from a TikTok video and save as JSON\n");
console.log("DOWNLOAD OPTIONS:");
console.log(" --format, -f Specify video format code");
@ -268,6 +270,10 @@ yargs(hideBin(process.argv))
'$0 formats https://www.youtube.com/watch?v=_oVI0GW-Xd4 --all',
'List all available video and audio formats for a YouTube video'
)
.example(
'$0 tiktok:meta https://www.tiktok.com/@username/video/1234567890 -o metadata.json',
'Scrape metadata from a TikTok video and save it to metadata.json'
)
.demandCommand(1, 'You need to specify a command')
.strict()
.help()

View File

@ -223,5 +223,93 @@ export const VideoFormatSchema = z.object({
export type VideoFormat = z.infer<typeof VideoFormatSchema>;
// TikTok metadata options schema
export const TikTokMetadataOptionsSchema = z.object({
url: z.string().url(),
outputPath: z.string(),
format: z.enum(['json', 'pretty']).optional().default('json'),
includeComments: z.boolean().optional().default(false),
timeout: z.number().int().positive().optional().default(30000),
userAgent: z.string().optional(),
proxy: z.string().optional(),
});
export type TikTokMetadataOptions = z.infer<typeof TikTokMetadataOptionsSchema>;
// TikTok metadata schema
export const TikTokMetadataSchema = z.object({
id: z.string(),
url: z.string().url(),
timestamp: z.number(),
scrapedAt: z.string().datetime(),
author: z.object({
id: z.string(),
uniqueId: z.string(), // username
nickname: z.string(),
avatarUrl: z.string().url().optional(),
verified: z.boolean().optional(),
secUid: z.string().optional(),
following: z.number().optional(),
followers: z.number().optional(),
likes: z.number().optional(),
profileUrl: z.string().url().optional(),
}),
video: z.object({
id: z.string(),
description: z.string(),
createTime: z.number(),
width: z.number(),
height: z.number(),
duration: z.number(),
ratio: z.string().optional(),
coverUrl: z.string().url().optional(),
playUrl: z.string().url().optional(),
downloadUrl: z.string().url().optional(),
shareCount: z.number().optional(),
commentCount: z.number().optional(),
likeCount: z.number().optional(),
viewCount: z.number().optional(),
hashTags: z.array(
z.object({
id: z.string(),
name: z.string(),
title: z.string().optional(),
})
).optional(),
mentions: z.array(z.string()).optional(),
musicInfo: z.object({
id: z.string().optional(),
title: z.string().optional(),
authorName: z.string().optional(),
coverUrl: z.string().url().optional(),
playUrl: z.string().url().optional(),
duration: z.number().optional(),
}).optional(),
}),
comments: z.array(
z.object({
id: z.string(),
text: z.string(),
createTime: z.number(),
likeCount: z.number(),
authorId: z.string(),
authorName: z.string(),
authorAvatar: z.string().url().optional(),
replies: z.array(
z.object({
id: z.string(),
text: z.string(),
createTime: z.number(),
likeCount: z.number(),
authorId: z.string(),
authorName: z.string(),
authorAvatar: z.string().url().optional(),
})
).optional(),
})
).optional(),
});
export type TikTokMetadata = z.infer<typeof TikTokMetadataSchema>;