Cosa ricevono davvero i crawler IA dal tuo sito? Uno script di 66 righe
Richiedi la tua pagina come browser e come ciascun crawler IA, poi confronta le risposte. Un 403, un 429 o una pagina di verifica solo per il crawler, oppure un 200 molto più piccolo della pagina del browser, significano che il firewall lo rifiuta anche quando robots.txt lo consente. Uno script Node di 66 righe lo fa per sette crawler e legge robots.txt secondo le regole della RFC 9309.
robots.txt dice a un crawler che cosa può richiedere. Non dice nulla su ciò che il tuo firewall o la tua CDN restituiscono davvero. Questo articolo ti dà un breve script che mostra le due cose affiancate, così vedi dove non coincidono.
In questa pagina
Perché robots.txt non ti dice cosa riceve un crawler?
robots.txt è una richiesta. Un firewall, una CDN o una regola di protezione dai bot decide che cosa viene davvero restituito, e può rispondere a OAI-SearchBot o a PerplexityBot con un 403, un 429 o una pagina "Just a moment..." mentre le tue visite dal browser sembrano perfettamente normali.
Il controllo consiste nel richiedere lo stesso URL come browser e come crawler, e confrontare. Un 403, 429 o 503 solo per il crawler, una pagina con titolo Just a moment... o una risposta 200 molto più piccola di quella del browser indicano tutti il firewall.
Lo script
Salvalo come ai-crawler-view.mjs. Richiede Node 18 o successivo e nessun pacchetto. Legge robots.txt una volta, richiede la tua pagina come browser, poi come sette crawler IA: OAI-SearchBot, ChatGPT-User, GPTBot, Claude-SearchBot, ClaudeBot, PerplexityBot e Perplexity-User.
#!/usr/bin/env node
// ai-crawler-view: what do AI crawlers get from YOUR site, compared with a browser?
// Usage: node ai-crawler-view.mjs https://your-site.com/page [--expect "a sentence from your page"]
// Node 18+, no dependencies. Run it against sites you own: it sends requests with crawler user agents.
const BROWSER = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36";
const BOTS = [ // [robots.txt token, user agent]; Anthropic prints no full strings, so Claude gets a token-based one
["OAI-SearchBot", "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; OAI-SearchBot/1.0; +https://openai.com/searchbot"],
["ChatGPT-User", "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ChatGPT-User/1.0; +https://openai.com/bot"],
["GPTBot", "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; GPTBot/1.1; +https://openai.com/gptbot"],
["Claude-SearchBot", "Mozilla/5.0 (compatible; Claude-SearchBot/1.0)"],
["ClaudeBot", "Mozilla/5.0 (compatible; ClaudeBot/1.0)"],
["PerplexityBot", "Mozilla/5.0 (compatible; PerplexityBot/1.0; +https://perplexity.ai/perplexitybot)"],
["Perplexity-User", "Mozilla/5.0 (compatible; Perplexity-User/1.0; +https://perplexity.ai/perplexity-user)"],
];
const BLOCK = new Set([401, 403, 406, 429, 451, 503, 999]);
const CHALLENGE = /Just a moment\.\.\.|Attention Required! \| Cloudflare|\/cdn-cgi\/challenge-platform|_Incapsula_Resource|Access Denied/i;
const [url, ...rest] = process.argv.slice(2);
const expect = rest.includes("--expect") ? rest[rest.indexOf("--expect") + 1] : "";
if (!url) { console.error("usage: node ai-crawler-view.mjs https://site/page [--expect \"text\"]"); process.exit(2); }
async function get(u, ua) {
try {
const r = await fetch(u, { headers: { "user-agent": ua }, redirect: "follow", signal: AbortSignal.timeout(15000) });
return { status: r.status, body: (await r.text()).slice(0, 500000) };
} catch (e) { return { status: 0, body: "", error: e.cause?.code || e.name }; }
}
// robots.txt, RFC 9309 in short: the group naming the token wins, else "*"; longest match wins; Allow wins a tie.
function robotsVerdict(txt, token, path) {
const groups = []; let cur = null;
for (const raw of txt.split(/\r?\n/)) {
const m = raw.replace(/#.*/, "").match(/^\s*([A-Za-z-]+)\s*:\s*(.*?)\s*$/); if (!m) continue;
const [k, v] = [m[1].toLowerCase(), m[2]];
if (k === "user-agent") { if (!cur || cur.rules.length) groups.push(cur = { agents: [], rules: [] }); cur.agents.push(v.toLowerCase()); }
else if (cur && (k === "allow" || k === "disallow") && v) cur.rules.push([k, v]);
}
const g = groups.find(x => x.agents.includes(token.toLowerCase())) || groups.find(x => x.agents.includes("*"));
if (!g) return "no rule";
let best = null;
for (const [k, p] of g.rules) {
const re = new RegExp("^" + p.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\\\$$/, "$"));
if (re.test(path) && (!best || p.length > best[1].length || (p.length === best[1].length && k === "allow"))) best = [k, p];
}
return best ? `${best[0]}: ${best[1]}` : "no rule";
}
const target = new URL(url);
const robots = await get(new URL("/robots.txt", target).href, BROWSER);
const robotsOk = robots.status >= 200 && robots.status < 300 && !/<html/i.test(robots.body);
const control = await get(url, BROWSER);
const cLen = control.body.length;
console.log(`control (browser): HTTP ${control.status}, ${cLen} bytes${expect ? `, expected text ${control.body.includes(expect) ? "found" : "MISSING"}` : ""}`);
if (control.status === 0 || BLOCK.has(control.status)) console.log(" the browser request itself failed or was refused: results below are not meaningful");
console.log(`robots.txt: ${robots.status >= 500 ? "server error (RFC 9309: crawlers must assume everything is disallowed)" : robotsOk ? "read" : "none or not valid"}\n`);
console.log("crawler robots.txt HTTP bytes verdict");
for (const [token, ua] of BOTS) {
const r = await get(url, ua);
const rule = robotsOk ? robotsVerdict(robots.body, token, target.pathname + target.search) : "no rule";
const challenge = CHALLENGE.test(r.body.slice(0, 20000)) && r.body.length < 20000;
const verdict = BLOCK.has(r.status) || challenge ? "BLOCKED by the server"
: r.status >= 400 || r.status === 0 ? `error ${r.status || r.error}`
: r.body.length < cLen * 0.5 ? "THIN: much smaller than the browser's page"
: expect && !r.body.includes(expect) ? "text MISSING from the HTML" : "ok";
console.log(`${token.padEnd(17)} ${rule.padEnd(19)} ${String(r.status).padEnd(5)} ${String(r.body.length).padEnd(7)} ${verdict}${rule.startsWith("disallow") ? " (robots.txt asks it to stay away)" : ""}`);
} Anthropic non pubblica le stringhe complete dello user agent, quindi le due righe di Claude usano solo il token del crawler. Un firewall che confronta il token reagisce allo stesso modo.
Come lo eseguo?
Eseguilo su una pagina del tuo sito. L'opzione facoltativa --expect verifica che una frase del tuo contenuto principale sia presente nell'HTML grezzo ricevuto da ogni crawler. Se manca, il testo viene aggiunto dagli script dopo il caricamento, e molti crawler non lo vedranno.
node ai-crawler-view.mjs https://your-site.com/pricing/ --expect "a sentence from your page" Eseguilo solo su siti tuoi o che hai il permesso di testare. Invia nove richieste: robots.txt, il browser e una per ogni crawler.
Che aspetto ha l'output?
Questo è il risultato su un server di test locale volutamente ostile, che sottopone OAI-SearchBot a una verifica, limita la frequenza di ClaudeBot, serve a PerplexityBot un guscio vuoto e vieta GPTBot in robots.txt:
control (browser): HTTP 200, 2618 bytes, expected text found
robots.txt: read
crawler robots.txt HTTP bytes verdict
OAI-SearchBot allow: / 403 31 BLOCKED by the server
ChatGPT-User allow: / 200 2618 ok
GPTBot disallow: / 200 2618 ok (robots.txt asks it to stay away)
Claude-SearchBot allow: / 200 2618 ok
ClaudeBot allow: / 429 9 BLOCKED by the server
PerplexityBot allow: / 200 36 THIN: much smaller than the browser's page
Perplexity-User allow: / 200 2618 ok Su aiseewhy.com ogni crawler riceve la pagina completa, con lo stesso stato e la stessa dimensione del browser.
Come si legge la tabella?
- La colonna robots.txt è il permesso che hai dato: la regola che si applica a quel crawler secondo la RFC 9309, cioè il gruppo che nomina il crawler, altrimenti
*, poi la regola corrispondente più lunga, conAllowche prevale in caso di parità. - Le colonne HTTP e byte mostrano ciò che ha fatto il server.
GPTBotmostra un 200 perché il server risponde a chiunque ignori robots.txt; la regola accanto è ciò a cui obbedisce un crawler che si comporta correttamente. - Le righe pericolose sono quelle opposte:
allow: /accanto aBLOCKEDoTHIN. È un sito che dice sì e risponde no.
Cosa non può dirti lo script?
- Prova gli user agent dal tuo indirizzo IP, non i veri crawler. Molti firewall verificano un crawler tramite gli intervalli IP pubblicati dal suo fornitore, quindi un vero
OAI-SearchBotpotrebbe passare quando la tua richiesta viene rifiutata, o il contrario. Usalo per trovare le regole che reagiscono allo user agent, poi controlla gli elenchi IP pubblicati dai fornitori. - Non esegue JavaScript, di proposito: mostra l'HTML che vedrebbe un crawler che non esegue il rendering.
- Un risultato pulito non è una raccomandazione. Essere leggibili non equivale a essere citati.
Cosa vediamo sui siti reali?
AISeeWhy esegue questo tipo di controllo per 14 crawler. Su 165 siti aziendali di Stati Uniti, Regno Unito e Francia che siamo riusciti a testare, il 38% (63 siti) ha respinto almeno un crawler IA a livello di server, mentre un browser dallo stesso indirizzo otteneva la pagina. Ognuno di questi siti ha rifiutato almeno un bot di addestramento o di scraping, e il 10% (16 siti) ha rifiutato anche almeno un crawler di ricerca IA, come PerplexityBot (11 siti) o OAI-SearchBot (5).
I siti non sono un campione casuale, e altri 53 non è stato possibile testarli perché persino una semplice richiesta da browser è stata rifiutata o è rimasta senza risposta. Consideralo uno schema da verificare sul tuo sito, non un censimento.
Prossimi passi
- Tester e verifica robots.txt per i crawler AI
- Controllo IP dei crawler AI
- Guarda un esempio di report completo
- Monitoraggio dei crawler AI
- Piani e prezzi
Crawler in questo articolo
Domande frequenti
È sicuro eseguirlo su qualsiasi sito?
Eseguilo solo su siti tuoi o che hai il permesso di testare. Invia richieste con user agent di crawler, che alcune difese anti-bot considerano ostili.
Perché GPTBot risulta ok se robots.txt lo vieta?
robots.txt è una richiesta, non un lucchetto. Il server risponde a chiunque la ignori, quindi la colonna HTTP dice ok. La regola accanto mostra ciò a cui obbedisce un crawler che si comporta correttamente.
Lo script esegue JavaScript?
No, di proposito. Mostra l'HTML che riceve un crawler che non esegue il rendering delle pagine. L'opzione --expect ti dice se il tuo testo principale è già in quell'HTML.
Un risultato pulito significa che ChatGPT citerà la mia pagina?
No. L'accesso è necessario ma non sufficiente. Per vedere se un assistente nomina il tuo sito, fagli le domande che fanno i tuoi clienti e annota quali siti cita.
Fonti
- RFC 9309: Robots Exclusion Protocol
- OpenAI: Overview of OpenAI crawlers
- Anthropic: Does Anthropic crawl data from the web, and how can site owners block the crawler?
- Perplexity: Perplexity crawlers
- Cloudflare: Manage AI crawlers (AI Crawl Control)