feat(subtitles): 字幕站(SubHD、字幕库)在线搜索与下载;rar / 7z 解压;验证码与页面解析在沙箱里
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
92d456d123
commit
59b3680f35
32 files changed
+1704
-166
No files matched your search
@@ -2,7 +2,10 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import {
|
||||
type SubtitleApplyRequest,
|
||||
SubtitleApplyResult,
|
||||
type SubtitleFetchRequest,
|
||||
SubtitleParseResponse,
|
||||
type SubtitleSearchRequest,
|
||||
SubtitleSearchResponse,
|
||||
SubtitleTargetsResponse,
|
||||
SubtitleWritesResponse,
|
||||
SubtitleWriteView,
|
||||
@@ -82,3 +85,18 @@ export function useUndoSubtitle(entityId: string) {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useSearchSubtitles() {
|
||||
return useMutation({
|
||||
mutationFn: async (body: SubtitleSearchRequest) =>
|
||||
parseOrThrow(SubtitleSearchResponse, await api.post<unknown>("/subtitles/search", body), "/subtitles/search"),
|
||||
});
|
||||
}
|
||||
|
||||
/** 下载一条在线字幕并解析(同上传的预览,不写文件) */
|
||||
export function useFetchSubtitle() {
|
||||
return useMutation({
|
||||
mutationFn: async (body: SubtitleFetchRequest) =>
|
||||
parseOrThrow(SubtitleParseResponse, await api.post<unknown>("/subtitles/fetch", body), "/subtitles/fetch"),
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user