Scrape a web page with JS and proxy
curl --request POST \
--url https://www.fetchserp.com/api/v1/scrape_js_with_proxy \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"url": "https://fetchserp.com",
"js_script": "return { h1: document.querySelector('h1')?.innerText, content: document.body.innerText }"
}
EOFimport requests
url = "https://www.fetchserp.com/api/v1/scrape_js_with_proxy"
payload = {
"url": "https://fetchserp.com",
"js_script": "return { h1: document.querySelector('h1')?.innerText, content: document.body.innerText }"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://fetchserp.com',
js_script: 'return { h1: document.querySelector(\'h1\')?.innerText, content: document.body.innerText }'
})
};
fetch('https://www.fetchserp.com/api/v1/scrape_js_with_proxy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.fetchserp.com/api/v1/scrape_js_with_proxy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://fetchserp.com',
'js_script' => 'return { h1: document.querySelector(\'h1\')?.innerText, content: document.body.innerText }'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.fetchserp.com/api/v1/scrape_js_with_proxy"
payload := strings.NewReader("{\n \"url\": \"https://fetchserp.com\",\n \"js_script\": \"return { h1: document.querySelector('h1')?.innerText, content: document.body.innerText }\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.fetchserp.com/api/v1/scrape_js_with_proxy")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://fetchserp.com\",\n \"js_script\": \"return { h1: document.querySelector('h1')?.innerText, content: document.body.innerText }\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.fetchserp.com/api/v1/scrape_js_with_proxy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://fetchserp.com\",\n \"js_script\": \"return { h1: document.querySelector('h1')?.innerText, content: document.body.innerText }\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"results": {
"h1": "<string>",
"content": "<string>"
}
}
}{
"error": "<string>"
}{
"success": true,
"message": "<string>"
}{
"error": "<string>"
}{
"status": 123,
"error": "<string>"
}Api
Scrape a web page with JS and proxy
POST
/
api
/
v1
/
scrape_js_with_proxy
Scrape a web page with JS and proxy
curl --request POST \
--url https://www.fetchserp.com/api/v1/scrape_js_with_proxy \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"url": "https://fetchserp.com",
"js_script": "return { h1: document.querySelector('h1')?.innerText, content: document.body.innerText }"
}
EOFimport requests
url = "https://www.fetchserp.com/api/v1/scrape_js_with_proxy"
payload = {
"url": "https://fetchserp.com",
"js_script": "return { h1: document.querySelector('h1')?.innerText, content: document.body.innerText }"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://fetchserp.com',
js_script: 'return { h1: document.querySelector(\'h1\')?.innerText, content: document.body.innerText }'
})
};
fetch('https://www.fetchserp.com/api/v1/scrape_js_with_proxy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.fetchserp.com/api/v1/scrape_js_with_proxy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://fetchserp.com',
'js_script' => 'return { h1: document.querySelector(\'h1\')?.innerText, content: document.body.innerText }'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.fetchserp.com/api/v1/scrape_js_with_proxy"
payload := strings.NewReader("{\n \"url\": \"https://fetchserp.com\",\n \"js_script\": \"return { h1: document.querySelector('h1')?.innerText, content: document.body.innerText }\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.fetchserp.com/api/v1/scrape_js_with_proxy")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://fetchserp.com\",\n \"js_script\": \"return { h1: document.querySelector('h1')?.innerText, content: document.body.innerText }\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.fetchserp.com/api/v1/scrape_js_with_proxy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://fetchserp.com\",\n \"js_script\": \"return { h1: document.querySelector('h1')?.innerText, content: document.body.innerText }\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"results": {
"h1": "<string>",
"content": "<string>"
}
}
}{
"error": "<string>"
}{
"success": true,
"message": "<string>"
}{
"error": "<string>"
}{
"status": 123,
"error": "<string>"
}Authorizations
A bearer token that will be supplied within an Authorization header as bearer <token>.
Query Parameters
The url to scrap
The country to use for the proxy
The javascript code to execute on the page
Response
success
Show child attributes
Show child attributes
⌘I