feat(downloaders): 添加抖音视频识别功能

- 新增 abogus.py 文件,实现 a_bogus 参数的生成逻辑
- 代码源自 JoeanAmier/TikTokDownloader 项目,并进行了适配和优化
- 功能包括生成用户代理字符串、加密 URL 参数和生成最终的 a_bogus值
- 提供了详细的注释和函数说明,便于理解和维护
This commit is contained in:
黄建武
2025-05-02 14:00:29 +08:00
parent 7066b4288a
commit 04dad3b72a
7 changed files with 957 additions and 123 deletions

View File

@@ -54,7 +54,7 @@ const formSchema = z
.superRefine((data, ctx) => {
const { video_url, platform } = data
if (platform === 'local') {
if (platform === 'local' || platform === 'douyin') {
if (!video_url || typeof video_url !== 'string') {
ctx.addIssue({
code: z.ZodIssueCode.custom,
@@ -249,7 +249,7 @@ const NoteForm = () => {
<SelectContent>
<SelectItem value="bilibili"></SelectItem>
<SelectItem value="youtube">Youtube</SelectItem>
{/*<SelectItem value="douyin">抖音</SelectItem>*/}
<SelectItem value="douyin"></SelectItem>
<SelectItem value="local"></SelectItem>
</SelectContent>
</Select>
@@ -335,45 +335,45 @@ const NoteForm = () => {
{/* 支持哔哩哔哩视频链接,例如:*/}
{/* https://www.bilibili.com/video/BV1vc25YQE9X/*/}
{/*</p>*/}
<FormField
control={form.control}
name="quality"
render={({ field }) => (
<FormItem>
<div className="my-3 flex items-center justify-between">
<h2 className="block"></h2>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<Info className="hover:text-primary h-4 w-4 cursor-pointer text-neutral-400" />
</TooltipTrigger>
<TooltipContent>
<p className="max-w-[200px] text-xs">
</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<Select onValueChange={field.onChange} defaultValue={field.value}>
<FormControl>
<SelectTrigger className="w-full">
<SelectValue placeholder="选择质量" />
</SelectTrigger>
</FormControl>
<SelectContent>
<SelectItem value="fast"></SelectItem>
<SelectItem value="medium"></SelectItem>
<SelectItem value="slow"></SelectItem>
</SelectContent>
</Select>
{/*<FormDescription className="text-xs text-neutral-500">*/}
{/* 质量越高,下载体积越大,速度越慢*/}
{/*</FormDescription>*/}
<FormMessage />
</FormItem>
)}
/>
{/*<FormField*/}
{/* control={form.control}*/}
{/* name="quality"*/}
{/* render={({ field }) => (*/}
{/* <FormItem>*/}
{/* <div className="my-3 flex items-center justify-between">*/}
{/* <h2 className="block">音频质量</h2>*/}
{/* <TooltipProvider>*/}
{/* <Tooltip>*/}
{/* <TooltipTrigger asChild>*/}
{/* <Info className="hover:text-primary h-4 w-4 cursor-pointer text-neutral-400" />*/}
{/* </TooltipTrigger>*/}
{/* <TooltipContent>*/}
{/* <p className="max-w-[200px] text-xs">*/}
{/* 质量越高,下载体积越大,速度越慢*/}
{/* </p>*/}
{/* </TooltipContent>*/}
{/* </Tooltip>*/}
{/* </TooltipProvider>*/}
{/* </div>*/}
{/* <Select onValueChange={field.onChange} defaultValue={field.value}>*/}
{/* <FormControl>*/}
{/* <SelectTrigger className="w-full">*/}
{/* <SelectValue placeholder="选择质量" />*/}
{/* </SelectTrigger>*/}
{/* </FormControl>*/}
{/* <SelectContent>*/}
{/* <SelectItem value="fast">快速(压缩)</SelectItem>*/}
{/* <SelectItem value="medium">中等(推荐)</SelectItem>*/}
{/* <SelectItem value="slow">高质量(清晰)</SelectItem>*/}
{/* </SelectContent>*/}
{/* </Select>*/}
{/* /!*<FormDescription className="text-xs text-neutral-500">*!/*/}
{/* /!* 质量越高,下载体积越大,速度越慢*!/*/}
{/* /!*</FormDescription>*!/*/}
{/* <FormMessage />*/}
{/* </FormItem>*/}
{/* )}*/}
{/*/>*/}
<FormField
control={form.control}