back to home

macbre / nodemw

MediaWiki API and WikiData client written in Node.js

View on GitHub
246 stars
54 forks
19 issues

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing macbre/nodemw in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/macbre/nodemw)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

nodemw MediaWiki API client written in node.js Requirements • At minimum Node.js at the maintenance version Installation Using npm Or Download the latest stable version via GitHub. Development version Features • HTTP requests are stored in the queue and performed in parallel with limited number of "threads" (i.e. there's no risk of flooding the server) • articles creation / edit / move / delete • file uploads (using given content or via provided URL) • Special:Log processing • listing articles in categories • and much more • getting claims from WikiData Where it's used • Over 25k edits on Poznań Wiki as Pyrabot - scripts repository First script An example script can be found in directory. You can enter **debug mode** by setting enviromental variable: You can enter **dry-run mode** (all "write" operations like edits and uploads will be disabled) by setting environmental variable (or entry in the config): Running unit tests How to use it? Creating a bot instance Config file nodemw can use config files as well as objects directly provided to object constructor. Config file is a JSON-encoded object with the following fields (see file): Making direct API calls nodemw allows you make direct calls to MediaWiki API (example querying Semantic MediaWiki API): Bot methods The last parameter of each function in nodemw API is a callback which will be fired when the requested action is done. **Callbacks use node.js style** - is always passed as the first argument. bot.logIn(username, password, callback) Log-in using given credentials - read more bot.getCategories(prefix, callback) Gets the list of all categories on a wiki bot.getAllPages(callback) Gets the list of all pages from the main namespace (excludes redirects) - read more bot.getPagesInCategory(category, callback) Gets the list of pages in a given category - read more bot.getPagesInNamespace(namespace, callback) Gets the list of pages in a given namespace - read more bot.getPagesByPrefix(prefix, callback) Gets the list of pages by a given prefix - read more bot.getPagesTranscluding(page, callback) Gets the list of pages that transclude the given pages - read more bot.getArticle(title, [redirect,] callback) Gets article content and redirect info - read more bot.getArticleRevisions(title, callback) Gets all revisions of a given article - read more bot.getArticleCategories(title, callback) Gets all categories a given article is in - read more bot.getArticleInfo(title, callback) Gets all info of a given article - read more bot.edit(title, content, summary, minor, callback) Creates / edits an article (and mark the edit as minor if _minor_ is set to true) - read more bot.append(title, content, summary, callback) Adds given content to the end of the page - read more bot.prepend(title, content, summary, callback) Adds given content to the beginning of the page - read more bot.addFlowTopic(title, topic, content, callback) Add a Flow topic - read more bot.delete(title, reason, callback) Deletes an article - read more bot.purge(titles, callback) Purge a given list of articles (titles or page IDs can be provided) - read more > By providing as argument you can purge all pages in a given category (available since MW 1.21) bot.protect(title, protections, options, callback) Protect a page (A title or page ID can be provided) - read more The value is an Array of protection information in the format: Calls to the Protect endpoint are not additive. Each call must include a list of _all_ intended protections, including any already in place. Each call will _replace_ all existing protections. bot.sendEmail(username, subject, text, callback) Send an email to an user - read more bot.getToken(title, action, callback) Returns token required for a number of MediaWiki API operations - read more>) / for MW 1.24+ bot.whoami(callback) Gets information about current bot's user (including rights and rate limits) - read more bot.whois(username, callback) Gets information about a specific user (including rights, current block, groups) - read more bot.whoare(usernames, callback) Gets information about specific users (including rights, current block, groups) - read more bot.createAccount(username, password, callback) Create account using given credentials - read more bot.move(from, to, summary, callback) Moves (aka renames) given article - read more bot.getImages(callback) Gets list of all images on a wiki bot.getImageUsage(filename, callback) Gets list of all articles using given image bot.getImagesFromArticle(title, callback) Get list of all images that are used on a given page - read more bot.getImageInfo(filename, callback) Gets metadata (including uploader, size, dimensions and EXIF data) of given image bot.getLog(type, start, callback) Get entries form Special:Log - read more bot.expandTemplates(content, title, callback) Returns XML with preprocessed wikitext - read more bot.parse(content, title, callback) Returns parsed wikitext - read more bot.fetchUrl(url, callback) Makes a GET request to provided resource and returns its content. bot.getRecentChanges(start, callback) Returns entries from recent changes (starting from a given point) bot.getSiteInfo(props, callback) Returns site information entries - read more bot.getSiteStats(props, callback) Returns site statistics (number of articles, edits etc) - read more bot.getMediaWikiVersion(callback) Returns the version of MediaWiki given site uses - read more client.getQueryPage(queryPage, callback) Returns entries from QueryPage-based special pages bot.upload(filename, content, summary _/* or extraParams */_, callback) Uploads a given raw content as a File:[filename] - read more bot.uploadByUrl(filename, url, summary _/* or extraParams */_, callback) Uploads a given external resource as a File:[filename] bot.uploadVideo(fileName, url, callback) Uploads a given video as a File:[filename] (Wikia-specific API) bot.getTempl…