Webcrawler API helps you to extract data from websites. It is a powerful tool that can be used to extract data from websites that do not provide an API. Read more about it here: Webcrawler API (opens in a new tab)
Prerequisites
In order to use Webcrawler API you need first to obtain an API key:
- Register on Webcrawler API Dashboard (opens in a new tab)
- Navigate to the API key section (opens in a new tab)
- Copy your API key
Note: You can use the API key to authenticate requests to the API.
First request
To make your first request you can use the following curl command:
curl --request POST \
--url https://api.webcrawlerapi.com/v1/crawl \
--header 'Authorization: Bearer <PASTE YOUR API KEY HERE>' \
--data '{
"items_limit": 5,
"url": "https://stripe.com/",
"scrape_type": "html"
}'
This command will start a new crawl job that will extract data from the Stripe website. The items_limit
parameter specifies how many items you want to extract. The clean_content
parameter specifies if you want to clean the extracted content from HTML tags.
Result:
{
"job_id": "5f7b1b7b-7b7b-4b7b-8b7b-7b7b7b7b7b7b", // <--- <CRAWL_JOB_ID>
}
Scrape request is done in asynchronous way. It means that you will receive a response with a task id. You can use this task id to check the status of the scraping task.
Get crawling result
To get the crawling result you can use the following curl command:
curl --request GET \
--url https://api.webcrawlerapi.com/v1/job/<CRAWL_JOB_ID> \
--header 'Authorization : Bearer <PASTE YOUR API KEY HERE>'
Result:
{
"job_id": "5f7b1b7b-7b7b-4b7b-8b7b-7b7b7b7b7b7b",
"url": "https://stripe.com/",
...
"status": "done",
"job_items": [
{
"id": "be0c2ae2-8545-4c4a-8728-5dd122878098",
"job_id": "be0c2ae2-8545-4c4a-8728-5dd122878098",
"original_url": "https://stripe.com",
"page_status_code": 200,
"raw_content_url": "https://data.webcrawlerapi.com/raw/clrgcx48g0001ozloz9ficivc/be0c2ae2-8545-4c4a-8728-5dd122878098/https:__stripe_com",
"clean_content_url": "https://data.webcrawlerapi.com/clean/clrgcx48g0001ozloz9ficivc/be0c2ae2-8545-4c4a-8728-5dd122878098/https:__stripe_com",
...
}
...
}