Country Code

country_code: string | null;

What's This?

The country_code option lets you tell the scraper to act as if it's visiting a website from a specific country. Websites might show different content or versions based on the visitor's location. By using the ISO 3166-1 alpha-2 format (a two-letter code representing countries), this option helps you see the version intended for a particular country.

How Does it Work?

Simply input the two-letter code of the country you want to emulate. For example:

  • Setting country_code=’us’ would use a proxy located in the United States, making the scraping request appear as if it's originating from there.

When Should I Use This?

Use the country_code option when you want to see how a website appears for visitors from a specific country. It's especially handy for websites that adjust their content based on the visitor's location or if you're trying to access content that's region-specific.

Methods

setCountryCode(string) 

Configuration Name: country_code

Initializing Scraper

const GeonodeScraperApi = require('geonode-scraper-api');
const scraper = new GeonodeScraperApi('<Your_username>', '<Your_password>');

Using Method

scraper.setCountryCode('us');
scraper.scrape('https://example.com/');

Using Configuration Object

const config = { country_code: 'us' };
scraper.scrape('https://example.com/', config);