A lightweight JavaScript & TypeScript wrapper for searching and fetching Wikipedia articles
You can install wikifly
using npm
npm install wikifly
Searches Wikipedia articles by keyword.
query
– Search string (e.g.,"JavaScript"
).limit
(optional) – Maximum number of results (default is10
).lang
(optional) – Language code for Wikipedia (default is"en"
).
An array of strings – the titles of the found articles.
const results = await wikifly.search("TypeScript", 5, "en");
console.log(results);
Fetches detailed information about a specific Wikipedia article.
- title – The exact title of the Wikipedia article.
- lang (optional) – Language code for Wikipedia (default is "en").
A WikiArticle object containing metadata and structured content.
const article = await wikifly.get("TypeScript", "en");
console.log(article.title); // Article title
console.log(article.intro); // Introductory paragraph
console.log(article.lastModified); // Last modified date
console.log(article.articleContent); // Array of content sections
import { wikifly } from "wikifly";
const foo = async () => {
const results = await wikifly.search("JavaScript", 5, "en");
console.log("Search results:", results);
const article = await wikifly.get("JavaScript", "en");
console.log("Article title:", article.title);
console.log("Intro:", article.intro);
};
foo();
© 2025 ZapolyarnyDev
This project is licensed under the MIT License – see the LICENSE file for details.