Appearance
API Overview
GET/api/v1
sh
# cURL is most likely already installed on your machine
curl -G "https://api.bitfetcher.io/v1/" \
-d api_key=YOUR_API_KEY \
-d url=https://httpbin.io/anythingpy
# pip install requests
import requests
url = 'https://httpbin.io/anything'
apikey = 'YOUR_API_KEY'
params = {
'url': url,
'api_key': apikey,
'js_render': 'true',
}
response = requests.get('https://api.bitfetcher.io/v1/', params=params)
print(response.text)js
// npm install axios
const axios = require('axios');
const url = 'https://httpbin.io/anything';
const apikey = 'YOUR_API_KEY';
axios({
url: 'https://api.bitfetcher.io/v1/',
method: 'GET',
params: {
'url': url,
'api_key': apikey,
'js_render': 'true',
},
})
.then(response => console.log(response.data))
.catch(error => console.log(error));go
package main
import (
"io"
"log"
"net/http"
)
func main() {
client := &http.Client{}
req, err := http.NewRequest("GET", "https://api.bitfetcher.io/v1/?api_key=YOUR_API_KEY&url=https%3A%2F%2Fhttpbin.io%2Fanything&js_render=true", nil)
resp, err := client.Do(req)
if err != nil {
log.Fatalln(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatalln(err)
}
log.Println(string(body))
}Parameters
Customize your scraping requests using the following parameters:
| Name | Description | Type | Default |
|---|---|---|---|
api_key required | Your unique API key for authentication | string | |
url required | URL of the page you want to scrape | string | |
| block_resources | Comma-separated list of resources to block from loading: image, stylesheet, font, media, manifest, other. | string | "" |
| custom_cookies | Enable custom cookies to be passed to the request. | boolean | False |
| custom_headers | Enable custom headers to be passed to the request. | boolean | False |
| device | Use either desktop or mobile user agents in the headers. (Not yet available) | string | "" |
| js_render | Render the JavaScript on the page with a headless browser. | boolean | False |
| js_scenario | The JavaScript instructions to execute on the page. | string | "" |
| json_response | Return the response in JSON format. | boolean | False |
| premium_proxy | Use premium proxies to make the request harder to detect. | boolean | False |
| proxy_country | Geolocation of the IP used to make the request. Only for Premium Proxies. | string | "" |
| custom_proxy | Use a custom proxy to make the request. | string | "" |
| screenshot | Take a screenshot of the page. | boolean | False |
| screenshot_format | The format of the screenshot: choose between png and jpeg formats, with PNG being the default | string | png |
| screenshot_fullpage | Take a full page screenshot. By default, only the visible portion of the page/viewport is captured. | boolean | False |
| screenshot_quality | The quality of the screenshot (1-100). Only applies to jpeg format. | integer | 100 |
| screenshot_selector | Take a screenshot of a specific CSS selector. | string | "" |
| session_id | A unique identifier for the session. This is useful for tracking requests and debugging. | string | "" |
| wait | Wait a fixed amount of time before returning the content (in milliseconds). (0-30000 milliseconds) | integer | 0 |
| wait_for | Wait for a given CSS/XPath Selector to load in the DOM before returning the content. | string | "" |
| extract_rules | Define rules to extract specific data from the page using CSS/XPath selectors | string | "" |
Models
Codes
| Code | Description | Type | Note |
|---|---|---|---|
200 | OK | Response / Html | You will get Response model if json_response=trueotherwise the HTML of scraped page |
400 | Bad Request | Error | Request was not processed, usually an error on the parameters |
500 | Internal Server Error | Error |
html
<html>parsed content</html>json
{
"message": "<string>",
"query": {
"<parameter>": "<string>"
}
}json
{
"message": "<string>"
}Error
| Name | Type | Description |
|---|---|---|
| message | string | The error message (optional) |
| query | json | The query parameters that caused the error |
Response
| Name | Type | Description |
|---|---|---|
| body | string | The content of the page |
| cookies | array of Cookie | The cookies set by the server |
| headers | object | The headers of the response |
| js_scenario_debug | array of JSScenarioDebug | Optional, debug information for each instruction |
| screenshot | Screenshot | Optional, base64 encoded image |
| status_code | integer | The status code of the response |
| type | string | html, json, xml, text, ... |
| extracted_data | object | The extracted data based on the extract_rules provided |
Cookie
Cookie represents an HTTP cookie, it's included in the response model.
| Name | Type | Description | Required |
|---|---|---|---|
| domain | string | optional | No |
| expires | string | optional | No |
| name | string | No | |
| path | string | No | |
| url | string | No | |
| value | string | No |
JSScenarioDebug
| Name | Type | Description |
|---|---|---|
| action | string | Action executed |
| duration | integer | Duration of the action |
| error | string | Error message if the action failed |
| params | object | Parameters of the action |
| success | boolean | If the action was successful |
Screenshot
Screenshot response model
| Name | Type | Description |
|---|---|---|
| data | string | Base64 encoded image |
| height | integer | Height of the screenshot (in pixels) |
| type | string | Image type (e.g. image/png) |
| width | integer | Width of the screenshot (in pixels) |

