AI ક્રૉલર્સને તમારી સાઇટ પરથી ખરેખર શું મળે છે? 66 લાઇનની સ્ક્રિપ્ટ

પ્રકાશિત

ટૂંકો જવાબ

તમારું પેજ બ્રાઉઝર તરીકે અને દરેક AI ક્રૉલર તરીકે મંગાવો, પછી સરખામણી કરો. ફક્ત ક્રૉલર માટે 403, 429 કે ચેલેન્જ પેજ આવે, અથવા 200 આવે પણ બ્રાઉઝરના પેજ કરતાં ઘણું નાનું હોય, તો robots.txt મંજૂરી આપતું હોવા છતાં ફાયરવૉલ તેને નકારે છે. 66 લાઇનની Node સ્ક્રિપ્ટ સાત ક્રૉલર્સ માટે આ કરે છે અને RFC 9309 ના નિયમો મુજબ robots.txt વાંચે છે.

robots.txt ક્રૉલરને જણાવે છે કે તે શું મેળવી શકે. પરંતુ તમારું ફાયરવૉલ કે CDN ખરેખર શું પાછું મોકલે છે તે વિશે તે કશું કહેતું નથી. આ પોસ્ટમાં એક ટૂંકી સ્ક્રિપ્ટ છે જે બંને બાજુબાજુમાં બતાવે છે, જેથી બંને ક્યાં અલગ પડે છે તે તમે જોઈ શકો.

આ પેજ પર
  1. robots.txt પરથી ક્રૉલરને શું મળે છે તે કેમ ખબર પડતી નથી?
  2. સ્ક્રિપ્ટ
  3. તે કેવી રીતે ચલાવવી?
  4. આઉટપુટ કેવું દેખાય છે?
  5. ટેબલ કેવી રીતે વાંચવું?
  6. સ્ક્રિપ્ટ શું જણાવી શકતી નથી?
  7. અસલી વેબસાઇટ્સ પર આપણને શું દેખાય છે?

robots.txt પરથી ક્રૉલરને શું મળે છે તે કેમ ખબર પડતી નથી?

robots.txt એક વિનંતી છે. ખરેખર શું પાછું મોકલવું તે ફાયરવૉલ, CDN કે બૉટ-પ્રોટેક્શન નિયમ નક્કી કરે છે, અને તે OAI-SearchBot કે PerplexityBot ને 403, 429 કે "Just a moment..." પેજ આપી શકે છે, જ્યારે તમારા પોતાના બ્રાઉઝરની મુલાકાતો બિલકુલ સામાન્ય લાગે છે.

તપાસ એ છે કે એ જ URL બ્રાઉઝર તરીકે અને ક્રૉલર તરીકે મંગાવો અને સરખામણી કરો. ફક્ત ક્રૉલર માટે 403, 429 કે 503, Just a moment... શીર્ષકવાળું પેજ, અથવા બ્રાઉઝરના જવાબ કરતાં ઘણો નાનો 200 જવાબ, આ બધું ફાયરવૉલ તરફ ઇશારો કરે છે.

સ્ક્રિપ્ટ

તેને ai-crawler-view.mjs તરીકે સેવ કરો. તેને Node 18 કે નવું જોઈએ અને કોઈ પેકેજની જરૂર નથી. તે robots.txt એક વાર વાંચે છે, તમારું પેજ બ્રાઉઝર તરીકે મેળવે છે, પછી સાત AI ક્રૉલર્સ તરીકે: OAI-SearchBot, ChatGPT-User, GPTBot, Claude-SearchBot, ClaudeBot, PerplexityBot અને 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 પૂરા user agent સ્ટ્રિંગ પ્રકાશિત કરતું નથી, તેથી બંને Claude લાઇનમાં ફક્ત ક્રૉલર ટોકન વપરાય છે. ટોકન પર મેળ બેસાડતું ફાયરવૉલ એ જ રીતે પ્રતિક્રિયા આપે છે.

તે કેવી રીતે ચલાવવી?

તેને તમારી પોતાની સાઇટના પેજ પર ચલાવો. વૈકલ્પિક --expect ફ્લેગ તપાસે છે કે તમારી મુખ્ય સામગ્રીનું એક વાક્ય દરેક ક્રૉલરને મળતા કાચા HTML માં છે કે નહીં. જો તે ન હોય, તો સ્ક્રિપ્ટો લોડ પછી ટેક્સ્ટ ઉમેરે છે, અને ઘણા ક્રૉલર્સ તેને જોઈ શકશે નહીં.

node ai-crawler-view.mjs https://your-site.com/pricing/ --expect "a sentence from your page"

તેને ફક્ત તમારી પોતાની કે ટેસ્ટ કરવાની પરવાનગી હોય તેવી સાઇટ્સ પર ચલાવો. તે નવ વિનંતીઓ મોકલે છે: robots.txt, બ્રાઉઝર અને દરેક ક્રૉલર માટે એક.

આઉટપુટ કેવું દેખાય છે?

આ એક જાણીજોઈને પ્રતિકૂળ બનાવેલા લોકલ ટેસ્ટ સર્વર સામેનું પરિણામ છે, જે OAI-SearchBot ને ચેલેન્જ કરે છે, ClaudeBot પર રેટ લિમિટ લગાવે છે, PerplexityBot ને ખાલી શેલ આપે છે અને robots.txt માં GPTBot ને disallow કરે છે:

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

aiseewhy.com પર દરેક ક્રૉલરને બ્રાઉઝર જેટલા જ સ્ટેટસ અને સાઇઝ સાથે આખું પેજ મળે છે.

ટેબલ કેવી રીતે વાંચવું?

સ્ક્રિપ્ટ શું જણાવી શકતી નથી?

અસલી વેબસાઇટ્સ પર આપણને શું દેખાય છે?

AISeeWhy 14 ક્રૉલર્સ માટે આવી તપાસ ચલાવે છે. US, UK અને ફ્રાન્સની 165 બિઝનેસ વેબસાઇટ્સમાં, જેને અમે ટેસ્ટ કરી શક્યા, 38% (63 સાઇટ્સ) એ સર્વર પર ઓછામાં ઓછા એક AI ક્રૉલરને પાછું કાઢ્યું, જ્યારે એ જ સરનામાંથી બ્રાઉઝરને પેજ મળ્યું. એમાંની દરેક સાઇટે ઓછામાં ઓછા એક ટ્રેનિંગ કે સ્ક્રેપર બૉટને નકાર્યો, અને 10% (16 સાઇટ્સ) એ ઓછામાં ઓછા એક AI સર્ચ ક્રૉલરને પણ નકાર્યો, જેમ કે PerplexityBot (11 સાઇટ્સ) કે OAI-SearchBot (5).

આ સાઇટ્સ રેન્ડમ નમૂનો નથી, અને બીજી 53 ટેસ્ટ થઈ શકી નહીં કારણ કે સાદી બ્રાઉઝર વિનંતી પણ નકારાઈ કે જવાબ વિના રહી. તેને તમારી સાઇટ પર તપાસવા જેવી પેટર્ન ગણો, વસ્તી ગણતરી નહીં.

મફત ટૂલ

આગળનાં પગલાં

આ લેખમાંના ક્રૉલર

વારંવાર પૂછાતા પ્રશ્નો

કોઈ પણ સાઇટ સામે આ ચલાવવું સલામત છે?

તેને ફક્ત તમારી પોતાની કે ટેસ્ટ કરવાની પરવાનગી હોય તેવી સાઇટ્સ સામે ચલાવો. તે ક્રૉલર user agent સાથે વિનંતીઓ મોકલે છે, જેને કેટલાક બૉટ ડિફેન્સ પ્રતિકૂળ ગણે છે.

robots.txt GPTBot ને disallow કરે છે તો પણ તે ok કેમ બતાવે છે?

robots.txt એક વિનંતી છે, તાળું નથી. તેને અવગણનાર કોઈને પણ સર્વર જવાબ આપે છે, તેથી HTTP કૉલમ ok કહે છે. તેની બાજુનો નિયમ બતાવે છે કે નિયમ પાળતો ક્રૉલર શું અનુસરે છે.

શું સ્ક્રિપ્ટ JavaScript ચલાવે છે?

ના, જાણીજોઈને નહીં. જે ક્રૉલર પેજ રેન્ડર કરતું નથી તેને જે HTML મળે છે તે તે બતાવે છે. --expect ફ્લેગ જણાવે છે કે તમારો મુખ્ય ટેક્સ્ટ પહેલેથી એ HTML માં છે કે નહીં.

ચોખ્ખા પરિણામનો અર્થ એ કે ChatGPT મારા પેજને ટાંકશે?

ના. પ્રવેશ જરૂરી છે પણ પૂરતો નથી. કોઈ અસિસ્ટન્ટ તમારી સાઇટનું નામ લે છે કે નહીં તે જોવા, તમારા ખરીદદારો પૂછે તેવા પ્રશ્નો તેને પૂછો અને તે કઈ સાઇટ્સ ટાંકે છે તે નોંધો.

સ્રોતો

વધુ લેખો