Datasets:
Download code/recrawl.py from sempite/llmstxt-corpus: direct link, hf CLI and curl.
- Browser
- Download file 1.7 kB
-
https://huggingface.co/datasets/sempite/llmstxt-corpus/resolve/main/code/recrawl.py
- Command line
-
hf download hf://datasets/sempite/llmstxt-corpus/code/recrawl.py
-
curl -L -o recrawl.py https://huggingface.co/datasets/sempite/llmstxt-corpus/resolve/main/code/recrawl.py
1.7 kB
| """Re-fetch the same 1,563 llms.txt files, six weeks after the August run. | |
| This is a NEW dated observation, not part of the published deposit. It exists so | |
| outreach to the directory maintainers carries current numbers rather than a | |
| six-week-old snapshot. | |
| It reuses crawl.py's own fetch and classification functions unchanged, so the | |
| two runs are directly comparable. The frame is rebuilt from the August run's | |
| own src field, which is the same 1,563 URLs. | |
| """ | |
| import concurrent.futures as cf | |
| import json, sys, time | |
| sys.path.insert(0, "/root/research/llms-txt/raw") | |
| import crawl # same UA, same timeout, same is_html and link-parsing rules | |
| RAW = "/root/research/llms-txt/raw/phase_a.jsonl" | |
| OUT = "/root/research/llms-txt/phase_a_2026-09-20.jsonl" | |
| aug = [json.loads(l) for l in open(RAW)] | |
| urls = [r["src"] for r in aug] | |
| print(f"re-fetching {len(urls)} llms.txt files", flush=True) | |
| print(f"user agent: {crawl.UA}\n", flush=True) | |
| t0 = time.time() | |
| rows = [] | |
| with cf.ThreadPoolExecutor(48) as ex: | |
| for i, r in enumerate(ex.map(crawl.phase_a, urls), 1): | |
| rows.append({k: v for k, v in r.items() if k != "links"}) | |
| if i % 300 == 0: | |
| print(f" {i}/{len(urls)} ({time.time()-t0:.0f}s)", flush=True) | |
| with open(OUT, "w") as f: | |
| for r in rows: | |
| f.write(json.dumps(r) + "\n") | |
| def healthy(r): | |
| return r["status"] == 200 and not r["is_html"] | |
| ha, hn = sum(map(healthy, aug)), sum(map(healthy, rows)) | |
| print(f"\ndone in {time.time()-t0:.0f}s -> {OUT}") | |
| print(f" 2026-08-05 healthy {ha}/{len(aug)} broken {len(aug)-ha} ({100*(len(aug)-ha)/len(aug):.1f}%)") | |
| print(f" 2026-09-20 healthy {hn}/{len(rows)} broken {len(rows)-hn} ({100*(len(rows)-hn)/len(rows):.1f}%)") | |