Skip to content

Commit 589e8bf

Browse files
Merge pull request #284 from SmythOS/feat/web-scrape-country
support proxy "country" for WebScrape
2 parents 4230bb6 + de04e39 commit 589e8bf

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

packages/core/src/Components/ScrapflyWebScrape.class.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export class ScrapflyWebScrape extends Component {
3939
javascriptRendering: Joi.boolean().default(false).label('Enable JavaScript Rendering'),
4040
autoScroll: Joi.boolean().default(false).label('Enable Auto Scroll'),
4141
format: Joi.string().default('markdown').label('Format').optional(),
42+
countries: Joi.array().items(Joi.string()).label('Countries').optional().allow(''),
4243
});
4344

4445
constructor() {
@@ -96,6 +97,10 @@ export class ScrapflyWebScrape extends Component {
9697

9798
async scrapeURL(url, data, key) {
9899
try {
100+
// Handle countries - convert array to comma-separated string (e.g., "us,ca,mx")
101+
const countryValue =
102+
data.countries && Array.isArray(data.countries) && data.countries.length > 0 ? data.countries.join(',').toLowerCase() : undefined;
103+
99104
const response = await axios({
100105
method: 'get',
101106
url: 'https://api.scrapfly.io/scrape',
@@ -107,8 +112,10 @@ export class ScrapflyWebScrape extends Component {
107112
...(data.antiScrapingProtection && { asp: true }),
108113
...(data.javascriptRendering && { render_js: true }),
109114
...(data.autoScroll && { auto_scroll: true, render_js: true }),
115+
...(countryValue && { country: countryValue }),
110116
},
111117
});
118+
112119
return {
113120
content: response.data?.result?.content,
114121
success: true,

packages/sdk/src/Components/generated/ScrapflyWebScrape.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export interface TScrapflyWebScrapeSettings {
1515
autoScroll?: boolean;
1616
/** Format */
1717
format?: string;
18+
/** Countries */
19+
countries?: any[];
1820
}
1921

2022
export type TScrapflyWebScrapeInputs = {

0 commit comments

Comments
 (0)