API Features
Basic request
To scrape a web page using the Scrape.Fun API, simply use the API's base endpoint and append the URL you would like to scrape as well as your API access key as GET parameters. There is also a series of optional parameters you can choose from. Below you will find an example request used to scrape the URL https://apple.com.
Example API Request:
https://api.scrape.fun/scrape
?token=YOUR_API_ACCESS_KEY
&url=https://apple.com
Request Parameters:
Key | Description |
---|---|
token | [Required] Specify your unique API access key to authenticate with the API. Your API access key can be found in your account dashboard. |
url | [Required] Specify the URL of the web page you would like to scrape. |
render_js | [optional] Set to 0 (off, default) or 1 (on) depending on whether or not to render JavaScript on the target web page. JavaScript rendering is done using a Google Chrome headless browser. |
proxy_location | [optional] Specify the 2-letter code of the country you would like to us as a proxy geolocation for your scraping API request. Supported countries differ by proxy type, please refer to the Proxy Locations section for details. |
Example API Response:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
[...] // 44 lines skipped
</head>
<body>
[...] // 394 lines skipped
</body>
</html>
API response shortened: Please note that the API response above has been shortened for readability purposes. To see the entire API resonse, please click the "Run" button in the Playground section of the dashboard.
JavaScript Rendering
By default, the Scrape.Fun API does not render JavaScript on the target web page. If you would like to render JavaScript on the target web page, you can do so by setting the render_js
parameter to 1
.
Example API Request:
https://api.scrape.fun/scrape
?token=YOUR_API_ACCESS_KEY
&url=https://apple.com
&render_js =1
Proxy Locations
The Scrape.Fun API is making use of a pool of 35+ million IP addresses worldwide. By default, the API will auto-rotate IP addresses in a way that the same IP address is never used twice in a row.
The Scrape.Fun API supports more than 100 global geolocations your scraping request can be sent from. Using the API's proxy_location HTTP GET parameter you can choose a specific country by its 2-letter country code for your scraping request. Please find an example API request below, which specifies au (for Australia) as proxy location.
Example API Request:
https://api.scrape.fun/scrape
?token=YOUR_API_ACCESS_KEY
&url=https://apple.com
&proxy_location=au
Supported Proxy Locations:
Code | Country |
---|---|
us | United States |
gb | Great Britain |
al | Albania |
ar | Argentina |
am | Armenia |
au | Australia |
at | Austria |
az | Azerbaijan |
bd | Bangladesh |
by | Belarus |
be | Belgium |
bo | Bolivia |
br | Brazil |
bg | Bulgaria |
kh | Cambodia |
ca | Canada |
cl | Chile |
cn | China |
co | Colombia |
cr | Costa Rica |
hr | Croatia (Hrvatska) |
cy | Cyprus |
cz | Czech Republic |
dk | Denmark |
do | Dominican Republic |
ec | Ecuador |
eg | Egypt |
ee | Estonia |
fi | Finland |
fr | France |
ge | Georgia |
de | Germany |
gr | Greece |
gt | Guatemala |
hk | Hong Kong |
hu | Hungary |
is | Iceland |
in | India |
id | Indonesia |
ie | Ireland |
im | Isle of Man |
il | Israel |
it | Italy |
jm | Jamaica |
jp | Japan |
jo | Jordan |
kz | Kazakhstan |
kg | Kyrgyzstan |
la | Laos |
lv | Latvia |
lt | Lithuania |
lu | Luxembourg |
my | Malaysia |
mx | Mexico |
md | Moldova |
nl | Netherlands |
nz | New Zealand |
no | Norway |
pe | Peru |
ph | Philippines |
ru | Russia |
sa | Saudi Arabia |
sg | Singapore |
kr | South Korea |
es | Spain |
lk | Sri Lanka |
se | Sweden |
ch | Switzerland |
tw | Taiwan |
tj | Tajikistan |
th | Thailand |
tr | Turkey |
tm | Turkmenistan |
ua | Ukraine |
ae | United Arab Emirates |
zu | Uzbekistan |
vn | Vietnam |