Datasets:
Download code/recheck.py from sempite/llmstxt-corpus: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/datasets/sempite/llmstxt-corpus/resolve/main/code/recheck.py
- Command line
-
hf download hf://datasets/sempite/llmstxt-corpus/code/recheck.py
-
curl -L -o recheck.py https://huggingface.co/datasets/sempite/llmstxt-corpus/resolve/main/code/recheck.py
1.24 kB
| import urllib.request,ssl,concurrent.futures as cf,collections | |
| ctx=ssl.create_default_context();ctx.check_hostname=False;ctx.verify_mode=ssl.CERT_NONE | |
| UA="Mozilla/5.0 (compatible; SempiteResearch/1.0; +https://sempite.com/research/)" | |
| def cl(d): | |
| try: | |
| r=urllib.request.urlopen(urllib.request.Request(f"https://{d}/llms.txt",headers={"User-Agent":UA}),timeout=8,context=ctx) | |
| b=r.read(4000).decode("utf-8","replace"); low=b.lower() | |
| if "store unavailable" in low or "store is currently unavailable" in low: k="shopify_unavailable" | |
| elif low.lstrip().startswith("user-agent") or "disallow-training" in low: k="robots_style" | |
| elif "agent instructions" in low or "ucp.dev" in low or "create_checkout" in low: k="ucp_template" | |
| elif b.strip().startswith("#") and b.count("](")>=2: k="genuine_map" | |
| elif len(b.strip())<25: k="empty" | |
| else: k="other_text" | |
| return k | |
| except Exception: return "err" | |
| doms=[l.strip() for l in open("cmap-recheck.txt") if l.strip()] | |
| c=collections.Counter() | |
| with cf.ThreadPoolExecutor(max_workers=30) as ex: | |
| for k in ex.map(cl,doms): c[k]+=1 | |
| print("re-classified", len(doms), "'content_map' rows:") | |
| for k,v in c.most_common(): print(f" {k:22} {v}") | |