[object Object]

← back to CelebritySignatures

works source 4: Wikidata P170+P18 by QID (keyless CORS WDQS -> Commons thumbs) — covers Rijksmuseum/Uffizi/Prado holdings; art-build audit: MET+AIC already integrated, Rijks key was placeholder + old API 410-retired (TK-10181)

248d9d26037240299f009d8465dc87a4acba6799 · 2026-08-03 11:36:06 -0700 · Steve Abrams

Files touched

Diff

commit 248d9d26037240299f009d8465dc87a4acba6799
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Aug 3 11:36:06 2026 -0700

    works source 4: Wikidata P170+P18 by QID (keyless CORS WDQS -> Commons thumbs) — covers Rijksmuseum/Uffizi/Prado holdings; art-build audit: MET+AIC already integrated, Rijks key was placeholder + old API 410-retired (TK-10181)
---
 public/index.html | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/public/index.html b/public/index.html
index b41bc20..bcc31b8 100644
--- a/public/index.html
+++ b/public/index.html
@@ -262,6 +262,20 @@ async function loadWorks(qid, name){
       works.push({ img, title:a.title||'Untitled', date:a.creation_date||'', url:a.url||'https://www.clevelandart.org/art/collection/search', src:'Cleveland Museum of Art' });
     }
   } catch {}
+  // 4) Wikidata works-by-QID (P170 creator + P18 image) — QID-exact, keyless,
+  //    CORS-open WDQS; surfaces Rijksmuseum/Uffizi/Prado CC0 images via Commons
+  //    (the old rijksmuseum.nl API is retired — 410 — so Commons carries them).
+  if (works.length < MAX) try {
+    const q = `SELECT ?w ?wLabel ?img ?date WHERE { ?w wdt:P170 wd:${qid} ; wdt:P18 ?img . OPTIONAL { ?w wdt:P571 ?date } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } LIMIT ${MAX*2}`;
+    const j = await (await fetch('https://query.wikidata.org/sparql?format=json&query='+encodeURIComponent(q), { headers:{ Accept:'application/sparql-results+json' } })).json();
+    for (const b of (j.results?.bindings||[])) {
+      if (works.length >= MAX) break;
+      const m = (b.img?.value||'').match(/Special:FilePath\/(.+)$/); if (!m) continue;
+      works.push({ img:`https://commons.wikimedia.org/wiki/Special:FilePath/${m[1]}?width=400`,
+        title:b.wLabel?.value||'Untitled', date:(b.date?.value||'').slice(0,4),
+        url:b.w?.value||'#', src:'Wikimedia Commons' });
+    }
+  } catch {}
   WORKS_CACHE[qid]=works; return works;
 }
 function openArtist(qid, push=true){

← 7318273 Artists mega-collage (895 verified signatures, 10x90 wall +  ·  back to CelebritySignatures  ·  Museum expansion final: 1262 artists (Cleveland 219, MFA Bos b6b478a →