Wikidata monitoring tool for tracking edits on watched items and generating HTML reports.
Repository: https://github.com/OSC-JYU/wd-watch
Wikidata requires a user-agent with contact info. Set it in config.json:
"user_agent": "WD-Watch/2.0 (https://github.com/OSC-JYU/wd-watch; CONTACT_EMAIL_HERE)"git clone https://github.com/OSC-JYU/wd-watch.git
cd wd-watch
npm install
npm startDefault server port is 8200.
make build
make startReports are exported to the public/reports directory.
If you still have an old database (data/watchlist.db), convert it to the current schema:
npm run convert:v1-to-v2 -- --dry-run
npm run convert:v1-to-v2Options:
--source <file>defaults todata/watchlist.db--target <file>defaults todata/watchlist_v2.db--runs <file>defaults todata/runs_v2.db--dry-runprints what would be converted without writing--forceoverwrites existing rows with the same QID
Status:
curl http://localhost:8200/api/statusAdd one item:
curl -XPOST 'http://localhost:8200/api/watchlist/Q42?wdset=Dougs'SPARQL import:
curl -G -XPOST 'http://localhost:8200/api/watchlist/query' \
--header "Accept: application/json" \
--data-urlencode wdset="Klimt" \
--data-urlencode query="
SELECT ?item ?itemLabel
WHERE
{
?item wdt:P31 wd:Q3305213 .
?item wdt:P170 wd:Q34661 .
SERVICE wikibase:label { bd:serviceParam wikibase:language \"fi,en\". }
}
limit 10
"Note: always include LIMIT in SPARQL imports. Large unbounded queries may take a long time.
If an item already exists in watchlist, import now counts it as skipped_existing (same set)
or skipped_other_set (already tracked in another set) instead of flooding failure output.
Create report:
curl -XPOST 'http://localhost:8200/api/watchlist/report?wdset=Klimt'By default, reports use email-safe template (optimized for email clients).
Use template=web for the richer browser layout:
curl -XPOST 'http://localhost:8200/api/watchlist/report?wdset=Klimt&template=web'Create report for a fixed lookback period (overrides saved last run):
curl -XPOST 'http://localhost:8200/api/watchlist/report?wdset=Klimt&days=21'Report files are written to public/reports/ and listed at:
curl 'http://localhost:8200/reports'Set MAILER and MAILER_PORT, then:
curl -XPOST 'http://localhost:8200/api/watchlist/report?wdset=Klimt&mail=somebody@somewhere.com'GET /api/statusGET /api/watchlist/setsGET /api/watchlist?wdset=<set>GET /api/watchlist/{qid}POST /api/watchlist/{qid}?wdset=<set>POST /api/watchlist/query?wdset=<set>&query=<sparql>DELETE /api/watchlist/{qid}DELETE /api/watchlist/sets?wdset=<set>POST /api/watchlist/report?wdset=<set>[&template=<email-safe|web>][&days=<1..3650>][&mail=<email>]GET /reports