Handbuch:Einen Bot erstellen

This page is a translated version of the page Manual:Creating a bot and the translation is 71% complete.

MediaWiki-Roboter oder einfach Bots sind automatische Prozesse, die mit Wikipedia (und anderen Wikimedia-Projekten) interagieren, als wären sie menschliche Bearbeiter. Diese Seite versucht zu erklären, wie man die Entwicklung eines Bots zur Verwendung in Wikimedia-Projekten durchführt, und vieles davon ist auf andere Wikis übertragbar, die auf MediaWiki basieren. Die Erklärung richtet sich vor allem an diejenigen, die bereits etwas Programmiererfahrung haben, jedoch unsicher sind, wie sie dieses Wissen bei der Erstellung eines MediaWiki-Bots anwenden können.

Warum sollte ich einen Bot erstellen?

Bots können Aufgaben automatisieren und sie viel schneller ausführen als Menschen. Falls es sich um eine einfache Aufgabe handelt, die vielfach ausgeführt werden soll (zum Beispiel ein Template auf alle 1000 Seiten einer Kategorie anwenden), dann ist diese eher für einen Bot geeignet als für einen Menschen.

Überlegungen vor der Erstellung eines Bots

Vorhandene Bots wiederverwenden

Oft ist es viel einfacher, einen Bot-Job von einem bestehenden Bot anzufordern. Wenn du nur gelegentlich Anfragen hast oder dich mit dem Programmieren nicht auskennst, ist das meist die beste Lösung. Einige Wikis haben eine spezielle Seite, auf der solche Anfragen gestellt werden können. Darüber hinaus existiert eine Reihe von Hilfsmitteln, die jedem zur Verfügung stehen. Die meisten davon haben die Form von erweiterten Webbrowsern mit MediaWiki-spezifischen Funktionen. The most popular of these is AutoWikiBrowser (AWB), a browser specifically designed to assist with editing on Wikipedia and other Wikimedia projects. Eine vollständige Liste der Werkzeuge findest du unter w:Wikipedia:Werkzeuge/Editierwerkzeuge auf der englischen Wikipedia. Tools wie AWB können oft mit wenig oder gar keinen Programmierkenntnissen bedient werden.

Use Toolhub to explore available tools for Wikimedia wikis.

Wiederverwendung der Codebase

Wenn du beschließt, dass du aufgrund der Häufigkeit oder Neuartigkeit deiner Anforderungen einen eigenen Bot brauchst, musst du ihn nicht von Grund auf neu schreiben. Viele Bots veröffentlichen ihren Quellcode, der manchmal mit wenig zusätzlicher Entwicklungszeit wiederverwendet werden kann Es stehen auch eine Reihe von Standard-Bot-Frameworks zum Download zur Verfügung. Diese Frameworks umfassen die überwiegende Mehrheit des Codes eines Bots. Da diese Bot-Frameworks allgemein verwendet werden und die komplexe Codierung von anderen erstellt und ausgiebig getestet wurde, ist es viel einfacher, Bots basierend auf diesen Frameworks zur Verwendung zugelassen zu bekommen. The most popular and common of these frameworks is Pywikibot (PWB), a bot framework written in Python. It is thoroughly documented and tested and many standardized Pywikibot scripts (bot instructions) are already available. Weitere Beispiele für Bot-Frameworks findest du unten. Bei einigen dieser Bot-Frameworks, wie z.B. PWB, reicht eine allgemeine Vertrautheit mit Skripten aus, um den Bot erfolgreich auszuführen (es ist wichtig, diese Frameworks regelmäßig zu aktualisieren).

Wichtige Fragen

Das Schreiben eines neuen Bots erfordert erhebliche Programmierkenntnisse. Ein komplett neuer Bot muss umfangreiche Tests durchlaufen, bevor er für den regulären Betrieb zugelassen wird. Die Planung ist entscheidend, um ein fehlerfreies, effizientes und effektives Programm zu erhalten. Folgende Vorüberlegungen sind wichtig:

  • Wird der Bot manuell unterstützt oder vollständig automatisiert?
  • Wirst du den Bot allein oder mit Hilfe anderer Programmierer erstellen?
  • In welcher Sprache wird der Bot implementiert?
  • Werden Anfragen, Bearbeitungen oder andere Aktionen des Bots protokolliert? Wenn ja, werden die Protokolle auf lokalen Medien oder auf Wiki-Seiten gespeichert?
  • Wird der Bot in einem Webbrowser ausgeführt (z. B. in JavaScript geschrieben) oder handelt es sich um ein eigenständiges Programm?
  • If the bot is a standalone program, will it run on your local computer, or on a remote server such as the Toolforge?
  • Wenn der Bot auf einem Remote-Server läuft, können andere Bearbeiter den Bot bedienen oder zum Laufen bringen?

Wie funktioniert ein MediaWiki-Bot?

Betriebsübersicht

Genau wie ein menschlicher Bearbeiter liest ein Mediawiki-Bot Wiki-Seiten und nimmt Änderungen vor, bei denen Änderungen vorgenommen werden müssen. Der Unterschied ist, dass Bots zwar schneller und weniger anfällig für Ermüdung sind als Menschen, aber sie sind bei weitem nicht so intelligent wie wir. Bots sind gut für sich wiederholende Aufgaben, die leicht definierte Muster haben und bei denen nur wenige Entscheidungen getroffen werden müssen.

Im typischsten Fall loggt sich ein Bot in seinen eigenen Account ein und ruft Seiten aus dem Wiki auf ähnliche Weise wie ein Browser auf - allerdings zeigt er die Seite nicht auf dem Bildschirm an, sondern bearbeitet sie im Speicher - und prüft dann programmatisch den Seitencode, um zu sehen, ob Änderungen vorgenommen werden müssen. Dann tut er die Änderungen, für die er gedacht ist, und schickt sie ab, ähnlich wie ein Browser.

Da Bots auf die gleiche Weise auf Seiten zugreifen wie Menschen, können Bots auf die gleichen Schwierigkeiten stoßen wie menschliche Nutzer. Sie können in Bearbeitungskonflikte geraten, Zeitüberschreitungen erleiden oder auf andere unerwartete Komplikationen stoßen, wenn sie Seiten abrufen oder bearbeiten. Da das Arbeitsvolumen, das ein Bot tut, größer ist als das einer lebenden Person, ist es wahrscheinlicher, dass der Bot auf diese Probleme stößt. Deshalb ist es wichtig, diese Situationen beim Schreiben eines Bots zu berücksichtigen.

APIs für Bots

Um Änderungen an Wiki-Seiten vorzunehmen, muss ein Bot zwangsläufig Seiten aus dem Wiki abrufen und Änderungen zurücksenden. Zu diesem Zweck existieren mehrere Anwendungsprogrammierschnittstellen (APIs).

  • MediaWiki Action API (api.php). Dieser Webservice wurde speziell dafür geschrieben, dass automatisierte Prozesse wie Bots Abfragen stellen und Änderungen vornehmen können. Die Daten werden im JSON-Format zurückgegeben (siehe Ausgabeformate für weitere Details).
    Status: Eingebaute Funktion von MediaWiki, verfügbar auf allen Wikimedia-Servern. Andere Nicht-Wikimedia-Wikis können den Schreibzugriff deaktivieren oder einschränken.
    Es existiert auch eine API-Sandbox für diejenigen, die die Funktionen von api.php testen wollen.
  • Special:Export can be used to obtain bulk export of page content in XML form. See Manual:Parameters to Special:Export for arguments;
    Status: Eingebaute Funktion von MediaWiki, verfügbar auf allen Wikimedia-Servern.
  • Raw (Wikitext) page processing: sending a action=raw or a action=raw&templates=expand GET request to index.php will give the unprocessed wikitext source code of a page. For example: https://en.wikipedia.org/w/index.php?title=Help:Creating_a_bot&action=raw. An API query with action=query&prop=revisions&rvprop=content or action=query&prop=revisions&rvprop=content&rvexpandtemplates=1 is roughly equivalent, and allows for retrieving additional information.
    Status: Eingebaute Funktion von MediaWiki, verfügbar auf allen Wikimedia-Servern.

Einige Webserver sind so konfiguriert, dass sie Anfragen für komprimierte (gzip) Inhalte zulassen. Das kannst du tun, indem du eine Zeile "Accept-Encoding: gzip" in den HTTP-Request-Header einfügst; wenn der HTTP-Reply-Header "Content-Encoding: gzip" enthält, liegt das Dokument im gzip-Format vor, andernfalls in der normalen, unkomprimierten Form. Beachte, dass dies spezifisch für den Webserver ist und nicht für die MediaWiki-Software. Andere Websites, die MediaWiki verwenden, haben diese Funktion möglicherweise nicht. Wenn du ein bestehendes Bot-Framework verwendest, sollte es Low-Level-Operationen wie diese beherrschen.

Einloggen

Zugelassene Bots müssen eingeloggt sein, um Änderungen erstellen zu können. Obwohl ein Bot Leseanfragen erstellen kann, ohne sich anzumelden, sollten sich Bots, die die Tests abgeschlossen haben, für alle Aktivitäten anmelden. Bots, die von einem Konto mit dem Bot-Flag (siehe #Bot-Flag unten) eingeloggt sind, können mehr Ergebnisse pro Anfrage von der Mediawiki-API (api.php) erhalten. Die meisten Bot-Frameworks sollten Login und Cookies automatisch verarbeiten. Wenn du jedoch kein existierendes Framework verwendest, musst du die folgenden Schritte ausführen.

Aus Sicherheitsgründen müssen die Anmeldedaten mit der Methode HTTP POST übermittelt werden. Da die Parameter von HTTP GET-Anfragen leicht in der URL sichtbar sind, sind Anmeldungen über GET deaktiviert.

Um einen Bot unter Verwendung der MediaWiki-API anzumelden, sind 2 POST-Anfragen erforderlich:

Request 1 – this is a GET request to obtain a login token

This will return a "logintoken" parameter in JSON form, as documented at API:Login. Andere Ausgabeformate sind verfügbar. Außerdem werden HTTP-Cookies wie unten beschrieben zurückgegeben.

Request 2 – this is a POST to complete the login

Dabei entspricht TOKEN dem Token aus dem vorherigen Rückgabewert. Die HTTP-Cookies aus der vorherigen Anfrage müssen auch bei der zweiten Anfrage übergeben werden.

Ein erfolgreicher Anmeldeversuch führt dazu, dass der Wikimedia-Server mehrere HTTP-Cookies festlegt. Der Bot muss diese Cookies speichern und sie bei jeder Anfrage zurücksenden (das ist besonders wichtig für die Bearbeitung). In der englischen Wikipedia sollten die folgenden Cookies verwendet werden: enwikiUserID, enwikiToken, und enwikiUserName. The enwikisession cookie is required to actually send an edit or commit some change, otherwise the MediaWiki:Session fail preview error message will be returned.

Main-account login via action=login is deprecated and may stop working without warning. To continue using bot code which logs in with action=login, see Special:BotPasswords.

Bearbeiten; Token bearbeiten

MediaWiki uses a system of edit tokens for making edits to MediaWiki pages, as well as other operations that modify existing content such as rollback. The token looks like a long hexadecimal number followed by '+\', for example:

d41d8cd98f00b204e9800998ecf8427e+\

Bearbeitungs-Token sollen verhindern, dass Nutzer durch das Anklicken eines einzigen Links dazu verleitet werden, eine Bearbeitung zu erstellen.

Der Bearbeitungsprozess umfasst zwei HTTP-Anfragen. Zuerst muss ein Antrag auf ein Bearbeitungs-Token erstellt werden. Dann muss eine zweite HTTP-Anfrage gestellt werden, die den neuen Inhalt der Seite zusammen mit dem gerade erhaltenen Bearbeitungs-Token sendet. Es ist nicht möglich, eine Bearbeitung in einer einzigen HTTP-Anfrage vorzunehmen. Ein Bearbeitungs-Token bleibt für die Dauer einer eingeloggten Sitzung gleich, sodass der Bearbeitungs-Token nur einmal abgerufen werden muss und für alle nachfolgenden Bearbeitungen verwendet werden kann.

Um ein Bearbeitungs-Token zu erhalten, befolge diese Schritte:

  • MediaWiki API (api.php). Make a request with the following parameters (see API:Edit - Create&Edit pages).
    • action=query
    • meta=tokens

    The token will be returned in the edittoken attribute of the response.

If the edit token the bot receives does not have the hexadecimal string (i.e., the edit token is just '+\') then the bot most likely is not logged in. Das kann verschiedene Ursachen haben: eine fehlgeschlagene Authentifizierung beim Server, eine unterbrochene Verbindung, eine Zeitüberschreitung oder ein Fehler beim Speichern oder Zurückgeben der richtigen Cookies. Wenn es nicht an einem Programmierfehler liegt, logge dich einfach erneut ein, um die Anmelde-Cookies zu aktualisieren. The bots must use assertion to make sure that they are logged in.

Bearbeitungskonflikte

Bearbeitungskonflikte entstehen, wenn mehrere, sich überschneidende Bearbeitungsversuche auf derselben Seite unternommen werden. Nahezu jeder Bot wird irgendwann in den ein oder anderen Bearbeitungskonflikt verwickelt und sollte daher einen Mechanismus enthalten, um mit solchen Situationen umzugehen.

Bots that use the Mediawiki API (api.php) should retrieve the edit token, along with the starttimestamp and the last revision "base" timestamp, before loading the page text in preparation for the edit; prop=info|revisions can be used to retrieve both the token and page contents in one query (example). When submitting the edit, set the starttimestamp and basetimestamp attributes, and check the server responses for indications of errors. For more details, see API:Edit - Create&Edit pages.

Allgemein sollte der Bot beim Fehlschlagen einer Bearbeitung die Seite erneut prüfen, bevor eine neue Bearbeitung vorgenommen wird, um zu prüfen, ob diese noch angebracht ist. Wenn ein Bot eine Seite erneut prüft, um eine Änderung einzupflegen, sollte man bei der Programmierung darauf achten, nicht in eine endlose Schleife zu geraten oder Verhalten zu produzieren, das einem Edit War gleicht.

Übersicht des Entwicklungsprozesses eines Bots

Das Schreiben oder Programmieren eines Bots ist nur ein Teil der Arbeit bei der Bot-Entwicklung.

Der untenstehende Entwicklungszyklus folgt einer Empfehlung der (englischen) Wikipedia.

 
Overview of English Wikipedia bot development cycle

Stelle bei der Entwicklung sicher, dass der Bot eventuelle Richtlinien des jeweiligen Wikis beachtet.

Idee

  • Die erste Aufgabe beim Schreiben eines MediaWiki-Bots ist das Erheben der Anforderungen, bzw. die Idee.
  • Prüfe vorher, ob nicht bereits ein existierender Bot das gleiche tut.

Spezifikation

  • Specification is the task of precisely describing the software to be written, possibly in a rigorous way. Du solltest zunächst einen detaillierten Vorschlag entwerfen, was genau dein Bot tun soll. Diskutiere den Vorschlag mit anderen Autoren und verfeinere ihn. Auch eine gute Idee kann durch Vorschläge von anderen Autoren noch verbessert werden.
  • Im mindesten sollte der Bot die folgenden Kriterien erfüllen:
  • Er ist harmlos (d.h. er macht keine Änderungen, die den reibungslosen Ablauf des Wikis gefährden).
  • Er ist nützlich (d.h. er erledigt eine nützliche Aufgabe effizienter, als dies ein Mensch tun könnte).
  • Er verschwendet keine Server-Ressourcen (Rechenzeit, Speicher, Netz-Traffic).

Software-Architektur

  • Think about how you might create it and which programming language(s) and tools you would use. Architecture is concerned with making sure the software system will meet the requirements of the product as well as ensuring that future requirements can be addressed. Manche Programmiersprachen sind für bestimmte Aufgaben besser geeignet als andere. Details findest du im nachstehenden Abschnitt zu Programmiersprachen.

Implementierung

Implementation (or coding) involves turning design and planning into code. It may be the most obvious part of the software engineering job, but it is not necessarily the largest portion. In the implementation stage you should:

  • Create an account for your bot. Go to the sign up page when logged in to create the account, linking it to yours. (If you do not create the bot account while logged in, it might be blocked on some wikis according to their policies)
  • Erstelle eine Benutzerseite für deinen Bot. Your bot's edits must not be made under your own account. Your bot will need its own account with its own username and password.
  • Add the same information to the user page of the bot. It would be a good idea to add a link to the approval page (whether approved or not) for each function.
  • Code your bot in your chosen programming language.

Testing

A good way of testing your bot as you are developing is to have it show the changes (if any) it would have made to a page, rather than actually editing the live wiki. Some bot frameworks (such as pywikibot) have pre-coded methods for showing diffs.

Dokumentation

An important (and often overlooked) task is documenting the internal design of your bot for the purpose of future maintenance and enhancement. This is especially important if you are going to allow clones of your bot. Ideally, you should post the source code of your bot on its userpage or in a revision control system (see #Open-source bots) if you want others to be able to run clones of it. This code should be well documented (usually using comments) for ease of use.

Queries/Complaints

You should be ready to respond to queries about or objections to your bot on your user talk page, especially if it is operating in a potentially sensitive area.

Wartung

Maintaining and enhancing your bot to cope with newly discovered bugs or new requirements can take far more time than the initial development of the software. Not only may it be necessary to add code that does not fit the original design, but just determining how software works at some point after it is completed may require significant effort (this is another reason to document your code as you go along).

General guidelines for running a bot

In addition to the official bot policy, which covers the main points to consider when developing your bot, there are a number of more general advisory points to consider when developing your bot.

Bot best practices

  • Set a custom User-Agent header for your bot (per the Wikimedia User-Agent policy, if your bot will be operating on Wikimedia wikis). If you don't, your bot may encounter errors and may end up blocked at the server level.
  • Use the maxlag parameter with a maximum lag of 5 seconds. This will enable the bot to run quickly when server load is low, and throttle the bot when server load is high.
    • If writing a bot in a framework that does not support maxlag, limit the total requests (read and write requests together) to no more than 10/minute.
  • Use the MediaWiki API whenever possible, and set the query limits to the largest values that the server permits, to minimize the total number of requests that must be made.
  • Edit (write) requests are more expensive in server time than read requests. Be edit-light and design your code to keep edits to a minimum.
    • Try to consolidate edits. One single large edit is better than 10 smaller ones.
  • Enable HTTP persistent connections and compression in your HTTP client library, if possible.
  • Do not make multi-threaded requests. Wait for one server request to complete before beginning another
  • Back off upon receiving errors from the server. Errors such as timeouts are often an indication of heavy server load. Use a sequence of increasingly longer delays between repeated requests.
  • Make use of assertion to ensure your bot is logged in.
  • Test your code thoroughly before making large automated runs. Individually examine all edits on trial runs to verify they are perfect.

Common bot features you should consider implementing

Manual assistance

If your bot is doing anything that requires judgment or evaluation of context (e.g., correcting spelling) then you should consider making your bot manually-assisted, which means that a human verifies all edits before they are saved. This significantly reduces the bot's speed, but it also significantly reduces errors.

Disabling the bot

It is good bot policy to have a feature to disable the bot's operation if it is requested. Remember that if your bot goes bad, it is your responsibility to clean up after it! You could have the bot refuse to run if a message has been left on its talk page, on the assumption that the message may be a complaint against its activities; this can be checked using the API meta=userinfo query (example on English Wikipedia). Or you could have a page that will turn the bot off if text on the page is changed (e.g. require the page be empty, contain only the word "True", or something similar); this can be checked by loading the page contents before each edit.

Signature

Just like a human, if your bot makes edits to a talk page in MediaWiki, it should sign its post with four tildes (~~~~). Signatures usually belong only on talk namespaces.

Bot Flag

A bot's edits will be visible at Special:RecentChanges, unless the edits are set to indicate a bot. Once the bot has been approved and given its bot flag permission, one can add the "bot-True" to the API call - see API:Edit#Parameters in order to hide the bot's edits in Special:RecentChanges.

In Python, using either mwclient or wikitools, then adding Bot=True to the edit/save command will set the edit as a bot edit - e.g.

PageObject.edit(text=pagetext, bot=True, summary=pagesummary)

Monitoring the bot status

If the bot is fully automated and performs regular edits, you should periodically check it runs as specified, and its behavior has not been altered by software changes.

Quelloffene Bots

Many bot operators choose to make their code open source, and occasionally it may be required before approval for particularly complex bots. Making your code open source has several advantages:

  • It allows others to review your code for potential bugs. As with prose, it is often difficult for the author of code to adequately review it.
  • Others can use your code to build their own bots. A user new to bot writing may be able to use your code as an example or a template for their own bots.
  • It encourages good security practices, rather than security through obscurity.
  • If you leave the project, it allows other users to run your bot tasks without having to write new code.

Open-source code, while rarely required, is typically encouraged in keeping with the open and transparent nature of wikis, though there are some cases when code should not be made public. For example, the open proxy-finding code of ProcseeBot could be used for malicious purposes on other sites.

Making code open source can add some extra work to coding. One has to make sure that sensitive information such as passwords is separated into a file that isn't made public.

There are several options available for users wishing to make their code open. Some users choose to put the code in a subpage of the bot's userspace, although this can be a hassle to maintain if not automated and results in the code being multi-licensed under the wiki's licensing terms in addition to any other terms you may specify. Another solution is to use a revision control system such as SVN, Git, or Mercurial. Wikipedia has articles comparing the different software options and websites for code hosting, many of which have no cost. Wikimedia also offers Git code repository hosting for its users and running Wikimedia related software tools via Wikimedia Cloud Services.

Programmiersprachen und Bibliotheken

See also: API:Client code

Bots können in fast jeder Programmiersprache geschrieben werden. Die Wahl der Programmiersprache hängt oft von der Erfahrung des Bot-Autoren mit diesen ab, sowie vom Vorhandensein passender Bibliotheken zur Erledigung der gewünschten Aufgaben. Im folgenden werden einige Sprachen aufgelistet, die über hilfreiche Bibliotheken für typische Bot-Aufgaben verfügen.

Awk

Perl

If located on a webserver, you can start your program running and interface with your program while it is running via the w:Common Gateway Interface from your browser. If your internet service provider provides you with webspace, the chances are good that you have access to a perl build on the webserver from which you can run your Perl programs.

Bibliotheken:

  • MediaWiki::API – Basic interface to the API, allowing scripts to automate editing and extraction of data from MediaWiki driven sites.
  • MediaWiki::Bot – A fairly complete MediaWiki bot framework written in Perl. Provides a higher level of abstraction than MediaWiki::API. Plugins provide administrator and steward functionality. Currently unsupported.

PHP

PHP kann auch verwendet werden, um Bots zu programmieren. MediaWiki-Entwickler sind bereits mit PHP vertraut, da dies die Sprache ist, in der MediaWiki und seine Erweiterungen geschrieben sind. Eine besonders gute Wahl ist PHP, wenn der Bot ein Webformular-basiertes Interface haben soll. Angenommen, du möchtest einen Bot zum Umbenennen von Kategorien erstellen. Du könntest ein HTML-Formular bauen, in dem du den aktuellen und gewünschten Namen der Kategorie schreibst. Wenn das Formular abgeschickt wird, kann dein Bot diese Eingaben lesen und alle Artikel in der aktuellen Kategorie in die gewünschte schieben. (Natürlich muss ein Bot mit Webformular-Interface vor zufälligen Websurfern (und Bots!) abgesichert sein.)

Die PHP bot functions-Tabelle in der englischen Wikipedia gibt Auskunft über die Fähigkeiten der größeren Bot-Frameworks.

PHP Bot frameworks
Key people[php 1] Name PHP Version last update Uses API[php 2] Exclusion compliant Admin functions Plugins Repository Notes
Cyberpower678, Addshore, and Jarry1250 Peachy 5.2.1 2015 Ja Ja Ja Ja GitHub Large framework, currently undergoing rewrite. Documentation currently non-existent, so poke w:User:Cyberpower678 for help.
Addshore mediawiki-api-base 7.4+ 2021 Ja N/A N/A extra libs GitHub Base library for interaction with the mediawiki api, provides you with ways to handle logging in, out and handling tokens as well as easily getting and posting requests.
Addshore mediawiki-api 7.4+ 2021 Ja Nein some extra libs GitHub Build on top of mediawiki-api-base this adds more advanced services for the api such as RevisionGetter, UserGetter, PageDeleter, RevisionPatroller, RevisionSaver etc.
Kaspo Phpwikibot Unknown 2009 Partial Nein Nein Nein Google Code Uses a single class.
Jarry1250 Wikibot 5 2009 Ja Ja Nein Nein enwiki Used solely by LivingBot. A fork of Phpwikibot. Uses a single class.
Foxy Loxy PHPediaWiki 5 2009 Ja Nein Ja Nein SourceForge Fork of SxWiki
Nzhamstar, Xymph, Waldyrious Wikimate 5.3-5.6,
7.x, 8.x
2023 Ja Nein Nein Nein GitHub Supports main article and file stuff. Authentication, checking if pages exist, reading and editing pages/sections. Getting file information, downloading and uploading files. Aims to be easy to use.
Kaleb Heitzman MediaWIkiBot 5 2012 Ja Nein Nein Nein GitHub Supports the entire API including uploading and importing. Also supports Semantic MediaWiki. Single Class that creates dynamic methods to work with any of the API calls.
Edward Z. Yang Wikipedia Bot in PHP Unknown 2005 Nein Nein Nein Nein enwiki "Probably stale" source code
Cobi wikibot.classes 5 2010 Ja Ja Nein Nein enwiki Used by multiple large bots (e.g. ClueBot and SoxBot). Uses several classes.
Valerio Bozzolan boz-mw 5.6 2019 Ja N/A Ja extra libs GitHub Object-oriented. 80+ classes also to handle Wikidata. Inline documentation. Support for file uploading.
  1. Does not include those who worked on frameworks forked to create listed framework.
  2. Where possible. Excludes uploading images and other such tasks which are not currently supported by the API.

Python

Python ist eine beliebte interpretierte Sprache mit objektorientierte Funktionen.

Libraries
Please help update this table.
Python Bot frameworks
Key people[py 1] Name Python Version last update Uses API[py 2] Exclusion compliant Admin functions Plugins Repository Notes
xqt Pywikibot Python 3.7 or higher or PyPy 2023 Ja Ja Ja Ja

Das am meisten verwendete Python-Bot-Framework. Enthält gebrauchsfertige Skripte.

Myst WikibaseIntegrator Python 3.7 or higher 2022 Ja Not applicable Ja Nein GitHub Only to interact with Wikibase instances like Wikidata
Mr.Z-man wikitools 2 2016 GitHub Incompatible with Python 3. (downloads)
Bryan mwclient 2021 GitHub An API-based framework
The Earwig mwparserfromhell 2021 GitHub A Python parser for MediaWiki text
  1. Does not include those who worked on frameworks forked to create listed framework.
  2. Where possible. Excludes uploading images and other such tasks which are not currently supported by the API.

Microsoft .NET

Microsoft .NET is a set of languages including C#, C++/CLI, Visual Basic .NET, J#, JScript .NET, IronPython, and Windows PowerShell. The Microsoft Visual Studio integrated development environment is often used, or the free Microsoft Visual Studio Express versions. Using Mono Project, .NET programs can also run on Linux, Unix, BSD, Solaris and Mac OS X as well as under Windows.

Bibliotheken:

  • DotNetWikiBot Framework – a full-featured client API on .NET, that allows to build programs and web robots easily to manage information on MediaWiki-powered sites. Now translated to several languages. Detailed compiled documentation is available in English.
  • WikiFunctions .NET library – Bundled with AWB, is a library of stuff useful for bots, such as generating lists, loading/editing articles, connecting to the recent changes IRC channel and more.

Java

Java-Programme werden üblicherweise mit einer IDE wie Eclipse oder NetBeans entwickelt. Es ist auch möglich, über die Konsole (mit den javac/java-Programmen) zu entwickeln.

Bibliotheken:

  • Java Wiki Bot Framework – A Java wiki bot framework
  • wiki-java – A Java wiki bot framework that is only one file
  • WPCleaner – The library used by the WPCleaner tool
  • jwiki – A simple and easy-to-use Java wiki bot framework

JavaScript (Node.js)

JavaScript is a scripting language used mainly on web pages, such as for user scripts added to your vector.js or your monobook.js pages. Using Node.js it is possible to use JavaScript server-side, such as for developing bots.

Please help to update this table.
NodeJS Bot frameworks
Key people[js 1] Name Nodejs Version last update Uses API[js 2] Exclusion compliant Admin functions Package Repository Notes
SD0001 mwn 10+ 2021 Ja Ja Ja npm GitHub Large library with classes for working with page titles and wikitext. Works with TypeScript also. Promise-based API (asyncawait). Limited wikitext parsing capabilities.
kanashimi wikiapi 0.10–15.x 2021 Ja Ja Partial npm GitHub JavaScript MediaWiki API for node.js with modern ECMAScript 2016 asyncawait and wikitext parser.
MediaWiki module 2014 GitHub Provides a framework of standard requests (e.g. log in, log out, etc.) as well as a general wrapper method for the MediaWiki API and includes throttling. The module can also be added to your Wikimedia .js page and used as library for on-wiki JS calls.
  1. Does not include those who worked on frameworks forked to create listed framework.
  2. Where possible. Excludes uploading images and other such tasks which are not currently supported by the API.

Ruby

Ruby ist eine beliebte dynamische, objektorientierte Programmiersprache.

Bibliotheken:

  • MediaWiki::Butt - Ruby framework for the API in active development. Tested with versions as up-to-date as CurseGamepedia is.
  • mediawiki/ruby/api, Ruby API client library. Last updated December 2017, no longer maintained, but still works.
  • MediaWiki::Gateway – Ruby framework for the API. Last updated January 2016. No longer in active development, tested up to MediaWiki 1.22, compatible with Wikimedia wikis. Unknown if still works.
  • wikipedia-client - Ruby framework using the API. Last updated March 2018. Unknown if still works.

Common Lisp

  • CL-MediaWiki implements MediaWiki API as a Common Lisp package. Is planned to use JSON as a query data format. Supports maxlag and assertion.

Haskell

VBScript

VBScript ist eine scripting language und basiert auf der Programmiersprache Visual Basic. Es gibt keine veröffentlichten Bot-Frameworks für VBScript. Im Folgenden sind aber einige in VBScript geschriebene Beispiel-Bots aufgelistet:

Beispiele:

Bash

Bash ist eine Unix-Shell.