MediaWiki API wrapper for Arturo
mwiki.art
MediaWiki API wrapper for Arturo
What does this package do?
This package provides a complete MediaWiki API wrapper for Arturo, enabling seamless interaction with any MediaWiki-powered wiki (Wikipedia, Wikia, etc.). It handles authentication, page retrieval and editing, search, category browsing, and more - with automatic cookie management under the hood.
How do I use it?
Simply import it and start interacting with your favorite wiki:
import 'mwiki!
; Connect to a MediaWiki instance
wiki: to :MW ["https://rosettacode.org/w/api.php"]!
; Retrieve a page
page: wiki\page "Fibonacci sequence"
print page\content
; Search for pages
results: wiki\search "palindrome" 5
print.lines results
; Get category members
cat: wiki\category "Programming Tasks"
print [cat\name "has" cat\members "members"]
; Login and edit (requires credentials)
using wiki [
if \login "username" "password" ->
\editPage "Test Page" "Hello, wiki!" "Created test page"
]
Type reference
MW
The main MediaWiki API client
constructor
to :MW [apiUrl :string]
fields
\apiUrl- the MediaWiki API endpoint\cookies- session cookies (managed automatically)\loggedIn- authentication status
methods
\login [username :string, password :string]- authenticate with the wiki\page [title :string]- retrieve page content by title\editPage [title :string, content :string, summary :string]- edit or create a page\category [name :string]- get all members of a category\search [query :string, limit :integer :null]- search wiki pages (default: 10 results)\user []- get current user information\recent [limit :integer :null]- get recent changes (default: 10 items)
mwPage
Represents a wiki page with its content
constructor
to :mwPage [title :string, content :string]
fields
\title- page title\content- page wikitext content
mwUser
Represents a MediaWiki user
constructor
to :mwUser [details :dictionary]
fields
\details- user information dictionary
mwCategory
Represents a wiki category with its members
constructor
to :mwCategory [name :string, members :integer]
fields
\name- category name\members- number of members
Tip
The wrapper automatically handles session cookies and CSRF tokens, so you don't need to worry about authentication state management! 😉
License
MIT License
Copyright (c) 2025 Yanis Zafirópulos
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
| 0.3.0 | 12 November 2025 | 15214 / 5 files |
| 0.2.0 | 11 November 2025 | 13980 / 5 files |
| 0.1.0 | 10 November 2025 | 12745 / 4 files |
No dependencies.