diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.ts index 22ac6294..633bbdf1 100644 --- a/apps/api/src/controllers/v1/types.ts +++ b/apps/api/src/controllers/v1/types.ts @@ -109,13 +109,26 @@ export const scrapeOptions = z.object({ extract: extractOptions.optional(), parsePDF: z.boolean().default(true), 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({ 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') + ).transform(val => val ? val.toUpperCase() : 'US'), + languages: z.string().array().optional(), }).optional(), skipTlsVerification: z.boolean().default(false), }).strict(strictMessage) @@ -445,7 +458,7 @@ export function legacyScrapeOptions(x: ScrapeOptions): PageOptions { fullPageScreenshot: x.formats.includes("screenshot@fullPage"), parsePDF: x.parsePDF, actions: x.actions as Action[], // no strict null checking grrrr - mogery - geolocation: x.geolocation, + geolocation: x.location ?? x.geolocation, skipTlsVerification: x.skipTlsVerification }; } diff --git a/apps/js-sdk/firecrawl/package.json b/apps/js-sdk/firecrawl/package.json index a7fb2d83..b8738e5e 100644 --- a/apps/js-sdk/firecrawl/package.json +++ b/apps/js-sdk/firecrawl/package.json @@ -1,6 +1,6 @@ { "name": "@mendable/firecrawl-js", - "version": "1.7.1", + "version": "1.7.2", "description": "JavaScript SDK for Firecrawl API", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/apps/js-sdk/firecrawl/src/index.ts b/apps/js-sdk/firecrawl/src/index.ts index 491df1e4..bbe934fe 100644 --- a/apps/js-sdk/firecrawl/src/index.ts +++ b/apps/js-sdk/firecrawl/src/index.ts @@ -82,6 +82,10 @@ export interface CrawlScrapeOptions { onlyMainContent?: boolean; waitFor?: number; timeout?: number; + location?: { + country?: string; + languages?: string[]; + }; } export type Action = {