@@ -21,11 +21,12 @@ import { getMockResponse } from './utils/mockResponse.js';
2121 * @param {boolean } [options.extractionMode=true] - Whether to use AI extraction (true) or markdown conversion (false).
2222 * AI extraction costs 10 credits per page, markdown conversion costs 2 credits per page.
2323 * @param {boolean } [options.stealth=false] - Enable stealth mode to avoid bot detection
24+ * @param {string } [options.locationGeoCode=null] - The geo code of the location to search in (e.g., "us", "gb", "de")
2425 * @returns {Promise<string> } Extracted data in JSON format matching the provided schema
2526 * @throws - Will throw an error in case of an HTTP failure.
2627 */
2728export async function searchScraper ( apiKey , prompt , numResults = 3 , schema = null , userAgent = null , options = { } ) {
28- const { mock = null , renderHeavyJs = false , extractionMode = true , stealth = false } = options ;
29+ const { mock = null , renderHeavyJs = false , extractionMode = true , stealth = false , locationGeoCode = null } = options ;
2930
3031 // Check if mock mode is enabled
3132 const useMock = mock !== null ? mock : isMockEnabled ( ) ;
@@ -61,6 +62,10 @@ export async function searchScraper(apiKey, prompt, numResults = 3, schema = nul
6162 payload . stealth = stealth ;
6263 }
6364
65+ if ( locationGeoCode ) {
66+ payload . location_geo_code = locationGeoCode ;
67+ }
68+
6469 if ( schema ) {
6570 if ( schema instanceof ZodType ) {
6671 payload . output_schema = zodToJsonSchema ( schema ) ;
0 commit comments