mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-11 11:29:02 +08:00
Merge pull request #830 from mendableai/nsc/geo-to-location
Geo-location rename to location
This commit is contained in:
commit
c96b36d045
@ -109,13 +109,26 @@ export const scrapeOptions = z.object({
|
|||||||
extract: extractOptions.optional(),
|
extract: extractOptions.optional(),
|
||||||
parsePDF: z.boolean().default(true),
|
parsePDF: z.boolean().default(true),
|
||||||
actions: actionsSchema.optional(),
|
actions: actionsSchema.optional(),
|
||||||
|
// New
|
||||||
|
location: z.object({
|
||||||
|
country: z.string().optional().refine(
|
||||||
|
(val) => !val || Object.keys(countries).includes(val.toUpperCase()),
|
||||||
|
{
|
||||||
|
message: "Invalid country code. Please use a valid ISO 3166-1 alpha-2 country code.",
|
||||||
|
}
|
||||||
|
).transform(val => val ? val.toUpperCase() : 'US'),
|
||||||
|
languages: z.string().array().optional(),
|
||||||
|
}).optional(),
|
||||||
|
|
||||||
|
// Deprecated
|
||||||
geolocation: z.object({
|
geolocation: z.object({
|
||||||
country: z.string().optional().refine(
|
country: z.string().optional().refine(
|
||||||
(val) => !val || Object.keys(countries).includes(val.toUpperCase()),
|
(val) => !val || Object.keys(countries).includes(val.toUpperCase()),
|
||||||
{
|
{
|
||||||
message: "Invalid country code. Please use a valid ISO 3166-1 alpha-2 country code.",
|
message: "Invalid country code. Please use a valid ISO 3166-1 alpha-2 country code.",
|
||||||
}
|
}
|
||||||
).transform(val => val ? val.toUpperCase() : 'US')
|
).transform(val => val ? val.toUpperCase() : 'US'),
|
||||||
|
languages: z.string().array().optional(),
|
||||||
}).optional(),
|
}).optional(),
|
||||||
skipTlsVerification: z.boolean().default(false),
|
skipTlsVerification: z.boolean().default(false),
|
||||||
}).strict(strictMessage)
|
}).strict(strictMessage)
|
||||||
@ -445,7 +458,7 @@ export function legacyScrapeOptions(x: ScrapeOptions): PageOptions {
|
|||||||
fullPageScreenshot: x.formats.includes("screenshot@fullPage"),
|
fullPageScreenshot: x.formats.includes("screenshot@fullPage"),
|
||||||
parsePDF: x.parsePDF,
|
parsePDF: x.parsePDF,
|
||||||
actions: x.actions as Action[], // no strict null checking grrrr - mogery
|
actions: x.actions as Action[], // no strict null checking grrrr - mogery
|
||||||
geolocation: x.geolocation,
|
geolocation: x.location ?? x.geolocation,
|
||||||
skipTlsVerification: x.skipTlsVerification
|
skipTlsVerification: x.skipTlsVerification
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mendable/firecrawl-js",
|
"name": "@mendable/firecrawl-js",
|
||||||
"version": "1.7.1",
|
"version": "1.7.2",
|
||||||
"description": "JavaScript SDK for Firecrawl API",
|
"description": "JavaScript SDK for Firecrawl API",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
@ -82,6 +82,10 @@ export interface CrawlScrapeOptions {
|
|||||||
onlyMainContent?: boolean;
|
onlyMainContent?: boolean;
|
||||||
waitFor?: number;
|
waitFor?: number;
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
|
location?: {
|
||||||
|
country?: string;
|
||||||
|
languages?: string[];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Action = {
|
export type Action = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user