Intro example
Scraping Fish is dead easy to use. Simply provide your API key and the URL you want to scrape as query parameters to our API endpoint. In the response, you receive the desired website HTML. Below is a simple example to get you started:
- cURL
- Python
- JavaScript
curl https://scraping.narf.ai/api/v1/?api_key=[your API key]&url=https://example.com
import requests
url = "https://example.com"
api_key = "[your API key]"
print(requests.get(f"https://scraping.narf.ai/api/v1/?api_key={api_key}&url={url}").content)
import axios from "axios";
const url = "https://example.com"
const apiKey = "[your API key]"
const response = await axios.get(`https://scraping.narf.ai/api/v1/?api_key=${apiKey}&url=${url}`);
console.log(response.data);
A response:
<!DOCTYPE html>
<html>
…
<body>
<div>
<h1>Example Domain</h1>
<p>
This domain is for use in illustrative examples in documents. You may
use this domain in literature without prior coordination or asking for
permission.
</p>
<p>
<a href="https://www.iana.org/domains/example">More information...</a>
</p>
</div>
</body>
</html>
And that's it! No need to worry about getting blocked.
info
If your URL contains query parameters, for example https://httpbin.org/get?best_api=scrapingfish&website=https://scrapingfish.com, you need to encode the URL.
note
If the request somehow fails, you won't be charged. Read more about possible response status codes in the next section.