Complete integration guide for calling your containerized browser API from any programming language or application
Your browser API is deployed globally on Cloudflare's edge network with container processing:
Download and analyze any website's HTML content
Extract structure and metadata from HTML content
Find elements using CSS selectors
// Fetch any website
const response = await fetch(
'https://gost-dom-browser-api.speedofmastry.workers.dev/browser',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
action: 'fetchURL',
url: 'https://example.com'
})
}
);
const result = await response.json();
console.log('HTML content:', result.data.html);
import requests
# Call the browser API
response = requests.post(
'https://gost-dom-browser-api.speedofmastry.workers.dev/browser',
json={
'action': 'fetchURL',
'url': 'https://example.com'
}
)
data = response.json()
print(f"Success: {data['success']}")
print(f"HTML length: {len(data['data']['html'])}")
using var client = new HttpClient();
var request = new {
action = "fetchURL",
url = "https://example.com"
};
var json = JsonSerializer.Serialize(request);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(
"https://gost-dom-browser-api.speedofmastry.workers.dev/browser",
content
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
HttpClient client = HttpClient.newHttpClient();
String json = """
{
"action": "fetchURL",
"url": "https://example.com"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://gost-dom-browser-api.speedofmastry.workers.dev/browser"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
requestData := map[string]interface{}{
"action": "fetchURL",
"url": "https://example.com",
}
jsonData, _ := json.Marshal(requestData)
resp, err := http.Post(
"https://gost-dom-browser-api.speedofmastry.workers.dev/browser",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
}
use reqwest;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let request_body = json!({
"action": "fetchURL",
"url": "https://example.com"
});
let response = client
.post("https://gost-dom-browser-api.speedofmastry.workers.dev/browser")
.json(&request_body)
.send()
.await?;
let text = response.text().await?;
println!("{}", text);
Ok(())
}
# Simple API call
$result = Invoke-RestMethod `
-Uri "https://gost-dom-browser-api.speedofmastry.workers.dev/browser" `
-Method POST `
-ContentType "application/json" `
-Body '{"action":"fetchURL","url":"https://example.com"}'
Write-Host "Success: $($result.success)"
Write-Host "HTML length: $($result.data.html.Length)"
# Parse HTML example
$parseResult = Invoke-RestMethod `
-Uri "https://gost-dom-browser-api.speedofmastry.workers.dev/browser" `
-Method POST `
-ContentType "application/json" `
-Body '{"action":"parseHTML","html":"<div>Hello</div>"}'
$parseResult | ConvertTo-Json -Depth 3
# Fetch URL
curl -X POST \
https://gost-dom-browser-api.speedofmastry.workers.dev/browser \
-H "Content-Type: application/json" \
-d '{"action":"fetchURL","url":"https://example.com"}'
# Parse HTML
curl -X POST \
https://gost-dom-browser-api.speedofmastry.workers.dev/browser \
-H "Content-Type: application/json" \
-d '{"action":"parseHTML","html":"<div>Hello</div>"}'
# Find Element
curl -X POST \
https://gost-dom-browser-api.speedofmastry.workers.dev/browser \
-H "Content-Type: application/json" \
-d '{"action":"getElement","html":"<div class=\"test\">Hello</div>","options":{"selector":".test"}}'
{
"action": "fetchURL|parseHTML|getElement",
"url": "https://example.com", // for fetchURL
"html": "<div>content</div>", // for parseHTML/getElement
"options": {"selector": ".class"} // for getElement
}
{
"success": true,
"data": {
"html": "...",
"containerProcessed": true,
"statusCode": 200,
"headers": {...}
}
}
{
"success": false,
"error": "Error message describing what went wrong"
}