
Agente scraper per API web
Reverse-engineer le API interne di qualsiasi sito web con linguaggio naturale
I siti web moderni caricano dati attraverso chiamate AJAX nascoste:
Strot analizza i siti web e scopre le loro chiamate API interne per te.
Cosa fa realmente Strot:
Ottieni l'esperienza completa di Strot (Interfaccia Web + API) immediatamente:
Usando il browser Patchright
docker run -d --name browser-server -p 5678:5678 synacktra/patchright-headless-server
STROT_ANTHROPIC_API_KEY=sk-ant-apiXXXXXX \
docker compose -f https://raw.githubusercontent.com/vertexcover-io/strot/refs/heads/main/docker-compose.yml up
Oppure, usando il browser Steel
STROT_BROWSER_WS_URL=wss://connect.steel.dev?apiKey=ste-XXXXXX STROT_ANTHROPIC_API_KEY=sk-ant-apiXXXXXX \
docker compose -f https://raw.githubusercontent.com/vertexcover-io/strot/refs/heads/main/docker-compose.yml up
Poi visita:
pip install strot
Oppure usando uv:
uv pip install strot
import strot
import asyncio
from pydantic import BaseModel
class Review(BaseModel):
title: str | None = None
username: str | None = None
rating: float | None = None
comment: str | None = None
date: str | None = None
async def get_reviews():
# Strot discovers the internal API that loads reviews
source = await strot.analyze(
url="https://www.getcleanpeople.com/product/fresh-clean-laundry-detergent/",
query="Customer reviews with ratings and comments",
output_schema=Review,
code_executor="e2b" # Defaults to "unsafe"
)
# Use the same API call the website uses, with full parameter control
async for reviews in source.generate_data(limit=500, offset=100, sortBy="date desc"):
for review in reviews:
print(f"{review['rating']}⭐ by {review['username']}: {review['comment']}")
if __name__ == "__main__":
asyncio.run(get_reviews())
import strot
import asyncio
from pydantic import BaseModel
class Product(BaseModel):
name: str | None = None
price: float | None = None
rating: float | None = None
availability: str | None = None
description: str | None = None
async def get_products():
# Strot finds the AJAX endpoint that loads product listings
source = await strot.analyze(
url="https://blinkit.com/cn/fresh-vegetables/cid/1487/1489",
query="Listed products with names and prices.",
output_schema=Product
)
# Set code executor of your choice into source
source.set_code_executor("e2b")
# Access all products with custom filtering and sorting
async for products in source.generate_data(limit=100, offset=0, category="vegetables", sortBy="price"):
for product in products:
print(f"{product['name']}: ${product['price']} ({product['rating']}⭐)")
if __name__ == "__main__":
asyncio.run(get_products())
Strot fornisce un server MCP (Model Context Protocol) che consente a client MCP come Claude di analizzare siti web e scoprire direttamente le loro API interne.
git clone https://github.com/vertexcover-io/strot.git
cd strot && uv sync --group mcp
Imposta le variabili d'ambiente:
export STROT_ANTHROPIC_API_KEY=sk-ant-apiXXXXXX
export STROT_BROWSER_MODE_OR_WS_URL=headless # or 'headed' or ws://browser-url
Se desideri utilizzare un browser ospitato, puoi fare quanto segue:
Esegui un server headless all'interno di docker
docker run -d --name browser-server -p 5678:5678 synacktra/patchright-headless-server
export STROT_BROWSER_MODE_OR_WS_URL=ws://localhost:5678/patchright
Oppure, connettiti a un server browser remoto:
export STROT_BROWSER_MODE_OR_WS_URL=wss://...
$ uv run strotmcp
Usage: strotmcp COMMAND
╭─ Commands ─────────────────────────────────────────────╮
│ http Start an http server. │
│ sse Start an sse server. │
│ stdio Start a stdio server. │
│ streamable-http Start a streamable http server. │
╰────────────────────────────────────────────────────────╯
stdio transport
claude mcp add strot-mcp "uv run strotmcp stdio" --transport stdio \
--env STROT_ANTHROPIC_API_KEY=$STROT_ANTHROPIC_API_KEY STROT_BROWSER_MODE_OR_WS_URL=$STROT_BROWSER_MODE_OR_WS_URL
sse, http, streamable-http transports
Esegui il server MCP con il trasporto desiderato in un terminale separato:
uv run strotmcp sse --port 8888
# uv run strotmcp http --host 0.0.0.0
# uv run strotmcp streamable-http --host 127.0.0.1 --port 8777
Aggiungi il server MCP a Claude:
claude mcp add strot-mcp http://127.0.0.1:8888/sse --transport sse
Testa e convalida l'accuratezza dell'analisi di Strot su diversi siti web e componenti individuali. Il sistema di valutazione supporta cinque tipi di input:
Confronta i risultati effettivi con quelli attesi, monitorando metriche come corrispondenza dell'URL di origine, rilevamento delle chiavi di paginazione, rilevamento dei parametri dinamici e accuratezza del conteggio delle entità. Tutte le valutazioni e i relativi passaggi di analisi dettagliati sono memorizzati in Airtable.
git clone https://github.com/vertexcover-io/strot.git
cd strot && uv sync --group eval
Crea una nuova base Airtable:
Create nel workspace desideratoBuild an app on your ownappXXXXXXXXXXXXXX)Crea un Personal Access Token:
/create/tokensdata.records:readdata.records:writeschema.bases:readschema.bases:writeCreate token e copia il token (es. patXXXXXXXXXXXXXX)Imposta le variabili d'ambiente:
Nota: Le tabelle necessarie vengono create automaticamente con lo schema appropriato quando esegui le valutazioni.
$ uv run stroteval
Usage: stroteval [OPTIONS]
Evaluate multiple job-based or task-based inputs from a file or stdin.
╭─ Parameters ──────────────────────────────────────────────────────────────────╮
│ --file -f Path to the JSON/JSONL file. If not provided, reads from stdin. │
╰───────────────────────────────────────────────────────────────────────────────╯
Assicurati che il server API sia in esecuzione se stai valutando input basati su job.
echo '[
{
"job_id": "existing-job-uuid",
"expected_source": "https://api.example.com/reviews",
"expected_pagination_keys": ["cursor", "limit"],
"expected_dynamic_keys": ["sortBy", "category"],
"expected_entity_count": 243
},
{
"site_url": "https://example.com/category/abc",
"query": "Listed products with name and prices",
"expected_source": "https://api.example.com/products",
"expected_pagination_keys": ["limit", "offset"],
"expected_dynamic_keys": ["category", "sortBy"],
"expected_entity_count": 100
},
{
"request": {
"method": "GET",
"url": "https://example.com/api/products",
"type": "ajax",
"queries": {"page": "2", "limit": "50", "sortBy": "price", "category": "electronics"}
},
"expected_pagination_keys": ["page", "limit"],
"expected_dynamic_keys": ["sortBy", "category"]
},
{
"response": {
"value": "",
"request": {
"method": "GET",
"url": "https://example.com/api/reviews",
"type": "ajax"
},
"preprocessor": {"element_selector": ".reviews-container"}
},
"output_schema_file": "review_schema.json",
"expected_entity_count": 10
}
]' | uv run stroteval
Licenza MIT - Usala come vuoi!
Fatto con ❤️ da Vertexcover Labs
export STROT_AIRTABLE_BASE_ID=appXXXXXXXXXXXXXX
export STROT_AIRTABLE_TOKEN=patXXXXXXXXXXXXXX
# set the following if you wish to evaluate separate tasks
export STROT_ANTHROPIC_API_KEY=sk-ant-apiXXXXXX