From de04e39c8cfb56908f25b152ddd70874a1b9c473 Mon Sep 17 00:00:00 2001 From: Forhad Hosain Date: Mon, 15 Dec 2025 01:16:05 +0600 Subject: [PATCH] support proxy "country" for WebScrape --- packages/core/src/Components/ScrapflyWebScrape.class.ts | 7 +++++++ packages/sdk/src/Components/generated/ScrapflyWebScrape.ts | 2 ++ 2 files changed, 9 insertions(+) diff --git a/packages/core/src/Components/ScrapflyWebScrape.class.ts b/packages/core/src/Components/ScrapflyWebScrape.class.ts index 34e100abb..bc7c03f29 100644 --- a/packages/core/src/Components/ScrapflyWebScrape.class.ts +++ b/packages/core/src/Components/ScrapflyWebScrape.class.ts @@ -39,6 +39,7 @@ export class ScrapflyWebScrape extends Component { javascriptRendering: Joi.boolean().default(false).label('Enable JavaScript Rendering'), autoScroll: Joi.boolean().default(false).label('Enable Auto Scroll'), format: Joi.string().default('markdown').label('Format').optional(), + countries: Joi.array().items(Joi.string()).label('Countries').optional().allow(''), }); constructor() { @@ -96,6 +97,10 @@ export class ScrapflyWebScrape extends Component { async scrapeURL(url, data, key) { try { + // Handle countries - convert array to comma-separated string (e.g., "us,ca,mx") + const countryValue = + data.countries && Array.isArray(data.countries) && data.countries.length > 0 ? data.countries.join(',').toLowerCase() : undefined; + const response = await axios({ method: 'get', url: 'https://api.scrapfly.io/scrape', @@ -107,8 +112,10 @@ export class ScrapflyWebScrape extends Component { ...(data.antiScrapingProtection && { asp: true }), ...(data.javascriptRendering && { render_js: true }), ...(data.autoScroll && { auto_scroll: true, render_js: true }), + ...(countryValue && { country: countryValue }), }, }); + return { content: response.data?.result?.content, success: true, diff --git a/packages/sdk/src/Components/generated/ScrapflyWebScrape.ts b/packages/sdk/src/Components/generated/ScrapflyWebScrape.ts index 5289c293c..5270c1a6c 100644 --- a/packages/sdk/src/Components/generated/ScrapflyWebScrape.ts +++ b/packages/sdk/src/Components/generated/ScrapflyWebScrape.ts @@ -15,6 +15,8 @@ export interface TScrapflyWebScrapeSettings { autoScroll?: boolean; /** Format */ format?: string; + /** Countries */ + countries?: any[]; } export type TScrapflyWebScrapeInputs = {