mirror of
https://github.com/mendableai/firecrawl.git
synced 2025-06-27 00:41:33 +00:00
feat(api/v1/extract): ignoreInvalidURLs (#1585)
This commit is contained in:
parent
6478754f1b
commit
749d89a551
@ -62,7 +62,9 @@ export async function extractController(
|
||||
const originalRequest = { ...req.body };
|
||||
req.body = extractRequestSchema.parse(req.body);
|
||||
|
||||
if (req.body.urls?.some((url: string) => isUrlBlocked(url, req.acuc?.flags ?? null))) {
|
||||
const invalidURLs: string[] = req.body.urls?.filter((url: string) => isUrlBlocked(url, req.acuc?.flags ?? null)) ?? [];
|
||||
|
||||
if (invalidURLs.length > 0 && !req.body.ignoreInvalidURLs) {
|
||||
if (!res.headersSent) {
|
||||
return res.status(403).json({
|
||||
success: false,
|
||||
@ -144,5 +146,8 @@ export async function extractController(
|
||||
success: true,
|
||||
id: extractId,
|
||||
urlTrace: [],
|
||||
...(invalidURLs.length > 0 && req.body.ignoreInvalidURLs ? {
|
||||
invalidURLs,
|
||||
} : {}),
|
||||
});
|
||||
}
|
||||
|
@ -478,6 +478,7 @@ export const extractV1Options = z
|
||||
.optional(),
|
||||
agent: agentOptionsExtract.optional(),
|
||||
__experimental_showCostTracking: z.boolean().default(false),
|
||||
ignoreInvalidURLs: z.boolean().default(false),
|
||||
})
|
||||
.strict(strictMessage)
|
||||
.refine((obj) => obj.urls || obj.prompt, {
|
||||
|
Loading…
x
Reference in New Issue
Block a user