requireString (wikidata/utils.js)

OpenCLI · clis/wikidata/utils.js · javascript · Apache-2.0
integration, Integration / API

Utility helpers for validating and fetching Wikidata entities, including ID checks and localized label selection.

// Source: https://github.com/jackwener/OpenCLI | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
// Shared helpers for the Wikidata adapters.
//
// Wikidata exposes two complementary public endpoints:
//   • `wbsearchentities` on `www.wikidata.org/w/api.php` for keyword → Q-IDs
//   • `Special:EntityData/<qid>.json` for the canonical entity dump
// No API key. Anonymous traffic is rate-limited but generous; we set a polite UA.
import { ArgumentError, CommandExecutionError, EmptyResultError } from '@jackwener/opencli/errors';

export const WIKIDATA_BASE = 'https://www.wikidata.org';
const UA = 'opencli-wikidata-adapter/1.0 (+https://github.com/jackwener/opencli; mailto:opencli@examp

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key