Geo-location
You may specify your geolocation when making request to a particular website. The accepted geolocation values can be country, state, city or coordinates, and radius, but vary depending on your target URL.
Google
Country
Pass the full country name just like with the Web Scraping API geo parameter
curl -k -v -x unblock.smartproxy.com:60000 \
-U "USERNAME:PASSWORD" "https://ip.smartproxy.com/" \
-H "X-SU-Geo: Germany"
import requests
proxies = {
'http': 'http://USERNAME:[email protected]:60000',
'https': 'http://USERNAME:[email protected]:60000'
}
headers= {
'X-SU-Geo': 'Germany'
}
response = requests.request(
'GET',
'https://ip.smartproxy.com/',
verify=False,
proxies=proxies,
headers=headers
)
print(response.text)
import fetch from 'node-fetch';
import createHttpsProxyAgent from 'https-proxy-agent'
const username = 'YOUR_USERNAME';
const password = 'YOUR_PASSWORD';
const agent = createHttpsProxyAgent(
`http://${username}:${password}@unblock.smartproxy.com:60000`
);
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;
const headers = {
'X-SU-Geo': 'Germany'
}
const response = await fetch('https://ip.smartproxy.com/', {
method: 'get',
headers: headers,
agent: agent
});
console.log(await response.text());
City
Pass City, State, Country
or State, Country
format (depending on the location) to the "X-SU-Geo" header, for example: "X-SU-Geo: New York,New York,United States"
or "X-SU-Geo: Berlin, Germany"
curl -k -v -x unblock.smartproxy.com:60000 \
-U "USERNAME:PASSWORD" "https://ip.smartproxy.com/" \
-H "X-SU-Geo: Berlin, Germany"
import requests
proxies = {
'http': 'http://USERNAME:[email protected]:60000',
'https': 'http://USERNAME:[email protected]:60000'
}
headers= {
'X-SU-Geo': 'Berlin, Germany'
}
response = requests.request(
'GET',
'https://ip.smartproxy.com/',
verify=False,
proxies=proxies,
headers=headers
)
print(response.text)
import fetch from 'node-fetch';
import createHttpsProxyAgent from 'https-proxy-agent'
const username = 'YOUR_USERNAME';
const password = 'YOUR_PASSWORD';
const agent = createHttpsProxyAgent(
`http://${username}:${password}@unblock.smartproxy.com:60000`
);
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;
const headers = {
'X-SU-Geo': 'Berlin, Germany'
}
const response = await fetch('https://ip.smartproxy.com/', {
method: 'get',
headers: headers,
agent: agent
});
console.log(await response.text());
State
Pass State, Country
format to the "X-SU-Geo"
header, for example: "X-SU-Geo: Arizona, United States"
curl -k -v -x unblock.smartproxy.com:60000 \
-U "USERNAME:PASSWORD" "https://ip.smartproxy.com/" \
-H "X-SU-Geo: Arizona, United States"
import requests
proxies = {
'http': 'http://USERNAME:[email protected]:60000',
'https': 'http://USERNAME:[email protected]:60000'
}
headers= {
'X-SU-Geo': 'Arizona, United States'
}
response = requests.request(
'GET',
'https://ip.smartproxy.com/',
verify=False,
proxies=proxies,
headers=headers
)
print(response.text)
import fetch from 'node-fetch';
import createHttpsProxyAgent from 'https-proxy-agent'
const username = 'YOUR_USERNAME';
const password = 'YOUR_PASSWORD';
const agent = createHttpsProxyAgent(
`http://${username}:${password}@unblock.smartproxy.com:60000`
);
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;
const headers = {
'X-SU-Geo': 'Arizona, United States'
}
const response = await fetch('https://ip.smartproxy.com/', {
method: 'get',
headers: headers,
agent: agent
});
console.log(await response.text());
Coordinates & Radius
Pass latitude, longitude and radius to the "X-SU-Geo"
header, for example: "X-SU-Geo: lat: 40.8448, lng: -73.8654, rad: 20000"
. The following example uses coordinates for The Bronx, New York City, USA
curl -k -v -x unblock.smartproxy.com:60000 \
-U "USERNAME:PASSWORD" "https://ip.smartproxy.com/" \
-H "X-SU-Geo: lat: 40.8448, lng: -73.8654, rad: 20000"
import requests
proxies = {
'http': 'http://USERNAME:[email protected]:60000',
'https': 'http://USERNAME:[email protected]:60000'
}
headers= {
'X-SU-Geo': 'lat: 40.8448, lng: -73.8654, rad: 20000'
}
response = requests.request(
'GET',
'https://ip.smartproxy.com/',
verify=False,
proxies=proxies,
headers=headers
)
print(response.text)
import fetch from 'node-fetch';
import createHttpsProxyAgent from 'https-proxy-agent'
const username = 'YOUR_USERNAME';
const password = 'YOUR_PASSWORD';
const agent = createHttpsProxyAgent(
`http://${username}:${password}@unblock.smartproxy.com:60000`
);
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;
const headers = {
'X-SU-Geo': 'lat: 40.8448, lng: -73.8654, rad: 20000'
}
const response = await fetch('https://ip.smartproxy.com/', {
method: 'get',
headers: headers,
agent: agent
});
console.log(await response.text());
Amazon
For most Amazon URLs, you can either send a zip/postcode or ISO-2 country code. The same rules and exceptions apply as with eCommerce Scraping API Amazon geo parameter
Zip/postcode
Localize results within the native country of the target marketplace, for example, when targeting amazon.com
marketplace you can pass a zipcode to the "X-SU-Geo"
header, for example: "X-SU-Geo: 10001"
header will have geolocation in New York
curl -k -v -x unblock.smartproxy.com:60000 \
-U "USERNAME:PASSWORD" "https://www.amazon.com/s?k=pikachu" \
-H "X-SU-Geo: 10001"
import requests
proxies = {
'http': 'http://USERNAME:[email protected]:60000',
'https': 'http://USERNAME:[email protected]:60000'
}
headers= {
'X-SU-Geo': '10001'
}
response = requests.request(
'GET',
'https://www.amazon.com/s?k=pikachu',
verify=False,
proxies=proxies,
headers=headers
)
print(response.text)
import fetch from 'node-fetch';
import createHttpsProxyAgent from 'https-proxy-agent'
const username = 'YOUR_USERNAME';
const password = 'YOUR_PASSWORD';
const agent = createHttpsProxyAgent(
`http://${username}:${password}@unblock.smartproxy.com:60000`
);
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;
const headers = {
'X-SU-Geo': '10001'
}
const response = await fetch('https://www.amazon.com/s?k=pikachu', {
method: 'get',
headers: headers,
agent: agent
});
console.log(await response.text());
ISO-2 country code
To localize results to a place outside the native country of the target marketplace you can use the ISO-2 country code, for example, to get geolocation - France, you could pass this value to the header: "X-SU-Geo: FR"
. The same exceptions apply as with eCommerce Scraping API Amazon geo parameter
When scraping Amazon targets from the
.com
domain, the success rate may be low when using a geolocation that's identical to the one associated with the domain. For instance, when targetingamazon.com
and usingX-SU-Geo: US
, you will likely get errors.In order to work around this, use localized ZIP codes that are used within the target country, eg.:
X-SU-Geo: 10001
, which would target New York, US.The same suggestion applies for the following domains:
.ca
,.co.uk
,.com.mx
,.de
,.fr
,.it
,.es
,.com.br
,.in
,.co.jp
,.nl
,.com.au
.
curl -k -v -x unblock.smartproxy.com:60000 \
-U "USERNAME:PASSWORD" "https://www.amazon.com/s?k=pikachu" \
-H "X-SU-Geo: FR"
import requests
proxies = {
'http': 'http://USERNAME:[email protected]:60000',
'https': 'http://USERNAME:[email protected]:60000'
}
headers= {
'X-SU-Geo': 'FR'
}
response = requests.request(
'GET',
'https://www.amazon.com/s?k=pikachu',
verify=False,
proxies=proxies,
headers=headers
)
print(response.text)
import fetch from 'node-fetch';
import createHttpsProxyAgent from 'https-proxy-agent'
const username = 'YOUR_USERNAME';
const password = 'YOUR_PASSWORD';
const agent = createHttpsProxyAgent(
`http://${username}:${password}@unblock.smartproxy.com:60000`
);
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;
const headers = {
'X-SU-Geo': 'FR'
}
const response = await fetch('https://www.amazon.com/s?k=pikachu', {
method: 'get',
headers: headers,
agent: agent
});
console.log(await response.text());
All other URLs
Country
Pass the full country name just like with the Web Scraping API geo parameter
curl -k -v -x unblock.smartproxy.com:60000 \
-U "USERNAME:PASSWORD" "https://ip.smartproxy.com/" \
-H "X-SU-Geo: Germany"
import requests
proxies = {
'http': 'http://USERNAME:[email protected]:60000',
'https': 'http://USERNAME:[email protected]:60000'
}
headers= {
'X-SU-Geo': 'Germany'
}
response = requests.request(
'GET',
'https://ip.smartproxy.com/',
verify=False,
proxies=proxies,
headers=headers
)
print(response.text)
import fetch from 'node-fetch';
import createHttpsProxyAgent from 'https-proxy-agent'
const username = 'YOUR_USERNAME';
const password = 'YOUR_PASSWORD';
const agent = createHttpsProxyAgent(
`http://${username}:${password}@unblock.smartproxy.com:60000`
);
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;
const headers = {
'X-SU-Geo:' 'Germany'
}
const response = await fetch('https://ip.smartproxy.com/', {
method: 'get',
headers: headers,
agent: agent
});
console.log(await response.text());
Updated about 1 year ago