← back to AsSeenInMovies
wikidata-enrich: add --byCredits to rank people by credit count (target high-recall enrichment)
40aa91fc6b755642fe9e614ebd3ae1ed44769014 · 2026-05-12 15:30:02 -0700 · SteveStudio2
Files touched
M scrapers/wikidata-enrich.js
Diff
commit 40aa91fc6b755642fe9e614ebd3ae1ed44769014
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date: Tue May 12 15:30:02 2026 -0700
wikidata-enrich: add --byCredits to rank people by credit count (target high-recall enrichment)
---
scrapers/wikidata-enrich.js | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/scrapers/wikidata-enrich.js b/scrapers/wikidata-enrich.js
index 5a8d42e..30fdbf4 100644
--- a/scrapers/wikidata-enrich.js
+++ b/scrapers/wikidata-enrich.js
@@ -33,6 +33,7 @@ const LIMIT = parseInt(args.limit || '1000', 10);
const BATCH = Math.min(parseInt(args['batch-size'] || '80', 10), 100);
const SLEEP_MS = parseInt(args.sleep || '1200', 10);
const PRIORITY = !!args.priority;
+const BY_CREDITS = !!args.byCredits; // rank people by credit count DESC (most-credited first)
const DRY = !!args.dry;
const UA = 'AsSeenInMovies/0.1 (https://asseeninmovies.com; steve@designerwallcoverings.com)';
@@ -162,7 +163,17 @@ async function enrichMovies() {
async function enrichPeople() {
const priorityClause = PRIORITY ? `
AND p.id IN (SELECT DISTINCT person_id FROM asim_credits)` : '';
- const sel = await pool.query(`
+ // BY_CREDITS = join credit-count and rank desc — most-credited untouched people first.
+ // Hit rate on bg1/bg2 random ordering was ~7-11%; credit-ranked should jump
+ // because famous actors have wikipedia articles.
+ const sel = BY_CREDITS ? await pool.query(`
+ SELECT p.id, p.imdb_id
+ FROM asim_people p
+ JOIN (SELECT person_id, count(*) AS c FROM asim_credits GROUP BY person_id) cc
+ ON cc.person_id = p.id
+ WHERE p.imdb_id LIKE 'nm%' AND p.wikidata_id IS NULL
+ ORDER BY cc.c DESC
+ LIMIT $1`, [LIMIT]) : await pool.query(`
SELECT p.id, p.imdb_id
FROM asim_people p
WHERE p.imdb_id LIKE 'nm%' AND p.wikidata_id IS NULL ${priorityClause}
← bdd362c feat(asseeninmovies): /movies + /people paginated index page
·
back to AsSeenInMovies
·
scaffold wikidata-commons-fallback.js — search Commons for h 96cf4db →