Datasets:
File size: 2,218 Bytes
4b541da | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | import json, csv, collections
AUG = "/root/research/llms-txt/raw/phase_a.jsonl"
SEP = "/root/research/llms-txt/phase_a_2026-09-20.jsonl"
OUT = "/root/research/llms-txt/broken_llmstxt_2026-09-20.csv"
def load(p):
return {r["src"]: r for r in (json.loads(l) for l in open(p))}
a, s = load(AUG), load(SEP)
ok = lambda r: r["status"] == 200 and not r["is_html"]
def reason(r):
if r["status"] == 0: return "unreachable (dns, tls or timeout)"
if r["status"] in (403, 429): return f"bot-blocked ({r['status']})"
if r["status"] == 404: return "404 not found"
if r["status"] >= 400: return f"http {r['status']}"
if r["is_html"]: return "returns an HTML page, not a text file"
if r["status"] != 200: return f"http {r['status']} (not a 200)"
return None
broke, fixed, still = [], [], []
for u in a:
wa, ws = ok(a[u]), ok(s[u])
if wa and not ws: broke.append(u)
elif not wa and ws: fixed.append(u)
elif not wa and not ws: still.append(u)
print(f"six weeks, same 1,563 files")
print(f" broken 2026-08-05 : {sum(1 for u in a if not ok(a[u])):>4} 15.7%")
print(f" broken 2026-09-20 : {sum(1 for u in s if not ok(s[u])):>4} 17.0%")
print()
print(f" newly broken : {len(broke):>4} worked in August, do not now")
print(f" fixed : {len(fixed):>4} were broken, work now")
print(f" still broken : {len(still):>4} broken in both runs")
print(f" net change : {len(broke)-len(fixed):>+4}")
print()
print("why the newly broken ones fail now:")
for k, v in collections.Counter(reason(s[u]) for u in broke).most_common():
print(f" {k:42} {v}")
print()
print("current breakdown, all broken:")
for k, v in collections.Counter(reason(s[u]) for u in s if not ok(s[u])).most_common():
print(f" {k:42} {v}")
rows = []
for u in sorted(s):
if ok(s[u]):
continue
rows.append({"llmstxt_url": u, "status": s[u]["status"],
"returned_html": s[u]["is_html"], "reason": reason(s[u]),
"worked_on_2026_08_05": ok(a[u])})
with open(OUT, "w", newline="") as f:
w = csv.DictWriter(f, fieldnames=list(rows[0]))
w.writeheader(); w.writerows(rows)
print(f"\nwrote {OUT} ({len(rows)} rows)")
|