Spidey v1.0 — mirror search: searches itself first, then bounces
Browse files- spidey.html +46 -0
spidey.html
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
| 2 |
+
<title>SPIDEY · mirror search</title>
|
| 3 |
+
<style>
|
| 4 |
+
body{margin:0;background:#05070d;color:#e8f0ff;font:15px system-ui}
|
| 5 |
+
header{padding:14px 16px;border-bottom:1px solid #1d2a44}
|
| 6 |
+
h1{margin:0;font-size:18px;letter-spacing:2px}h1 b{color:#ff3b3b}
|
| 7 |
+
#q{width:100%;box-sizing:border-box;margin-top:10px;padding:12px;font-size:17px;border-radius:10px;border:1px solid #2b3d63;background:#0b1222;color:#fff}
|
| 8 |
+
#stat{font-size:12px;opacity:.7;margin-top:6px}
|
| 9 |
+
.hit{padding:10px 16px;border-bottom:1px solid #111a2e}
|
| 10 |
+
.hit a{color:#7fc4ff;text-decoration:none}.src{font-size:11px;opacity:.6}
|
| 11 |
+
.m a{font-size:11px;margin-right:8px;color:#9fe39f}
|
| 12 |
+
</style></head><body>
|
| 13 |
+
<header><h1>🕸️🪞 <b>SPIDEY</b> · shoots the web at himself</h1>
|
| 14 |
+
<input id="q" placeholder="search the mirror…" autofocus>
|
| 15 |
+
<div id="stat">loading his own reflection…</div></header>
|
| 16 |
+
<div id="out"></div>
|
| 17 |
+
<script>
|
| 18 |
+
const OWNER='autobahn247365', SELF='autobahn247365/ghost';
|
| 19 |
+
let web=[];
|
| 20 |
+
const mirrors=u=>`<span class="m"><a href="https://web.archive.org/web/*/${u}" target=_blank>WB</a><a href="https://archive.ph/${u}" target=_blank>AT</a></span>`;
|
| 21 |
+
async function j(u){try{const r=await fetch(u);return r.ok?await r.json():[]}catch(e){return[]}}
|
| 22 |
+
async function t(u){try{const r=await fetch(u);return r.ok?await r.text():''}catch(e){return''}}
|
| 23 |
+
async function load(){
|
| 24 |
+
// 1. himself: his own Space files
|
| 25 |
+
const self=await j(`https://huggingface.co/api/spaces/${SELF}/tree/main?recursive=1`);
|
| 26 |
+
self.filter(f=>f.type==='file').forEach(f=>web.push({n:f.path,u:`https://huggingface.co/spaces/${SELF}/blob/main/${f.path}`,s:'self'}));
|
| 27 |
+
// 2. his own CSV rows (ISIC spine etc.)
|
| 28 |
+
for(const f of self.filter(f=>/\.csv$/.test(f.path))){
|
| 29 |
+
const txt=await t(`https://huggingface.co/spaces/${SELF}/resolve/main/${f.path}`);
|
| 30 |
+
txt.split('\n').slice(1).forEach((l,i)=>{if(l.trim())web.push({n:l.slice(0,160),u:`https://huggingface.co/spaces/${SELF}/blob/main/${f.path}#L${i+2}`,s:'self · '+f.path})});
|
| 31 |
+
}
|
| 32 |
+
// 3. bounce: every Space, model, dataset he owns
|
| 33 |
+
for(const k of ['spaces','models','datasets']){
|
| 34 |
+
(await j(`https://huggingface.co/api/${k}?author=${OWNER}&limit=1000`)).forEach(r=>web.push({n:r.id,u:`https://huggingface.co/${k==='models'?'':k+'/'}${r.id}`,s:'bounce · '+k}));
|
| 35 |
+
}
|
| 36 |
+
document.getElementById('stat').textContent=`${web.length} mirrors on the web · searched offline in this page`;
|
| 37 |
+
show('');
|
| 38 |
+
}
|
| 39 |
+
function show(q){
|
| 40 |
+
q=q.toLowerCase().split(/\s+/).filter(Boolean);
|
| 41 |
+
const hits=web.filter(w=>q.every(x=>(w.n+' '+w.s).toLowerCase().includes(x))).slice(0,300);
|
| 42 |
+
document.getElementById('out').innerHTML=hits.map(h=>`<div class=hit><a href="${h.u}" target=_blank>${h.n.replace(/</g,'<')}</a> ${mirrors(h.u)}<div class=src>${h.s}</div></div>`).join('');
|
| 43 |
+
}
|
| 44 |
+
document.getElementById('q').oninput=e=>show(e.target.value);
|
| 45 |
+
load();
|
| 46 |
+
</script></body></html>
|