Jump to content
Sign in to follow this  

4 MediaWiki UDFs that need testing!

Recommended Posts

Not 100% certain that this is the right forum to post in, but it's my best guess...

I'm working on a small library of MediaWiki UDFs for AutoIt, and I've finished writing and doing basic debugging on the four most basic (_MediaWIki_Login, _MediaWIki_GetToken, _MediaWIki_Edit, and _MediaWIki_Logout). They probably won't break down under simple misuses and things like that, but they probably aren't worthy of beta yet either, even if they were the whole library. So consider this a kind of pre-alpha.

I would appreciate it if you would give up ten minutes to try these functions out and let me know if they work, and/or look over my code and point out any noobish mistakes I may have made. Here's the function documentation (some of the errors are less than useful, I'm afraid):

_MediaWiki_Login($site, $user, $pass)
Example: $cookies = _MediaWiki_Login("http://www.mediawiki.org/w/api.php", "benzrf", "secret")
Return Value: An array of cookies that contain login and session information, or "" on error.
@error: 1 if any of the arguments is not a string, 2 if there was an error code from winhttprequest
(such as 404), 3 if the login was not successful.
Note: Any other function that takes an argument called "loginCookies" should use this function's
return value as that argument.

_MediaWiki_Logout($site, $loginCookies)
Example: _MediaWiki_Logout("http://www.mediawiki.org/w/api.php", $cookies)
Return Value: None

_MediaWiki_GetToken($site, $loginCookies[, $pageName = "Main Page"])
Example: $token = _MediaWiki_GetToken("http://www.mediawiki.org/w/api.php", $cookies, "Sandbox")
Return Value: A token used for most kinds of token-requiring requests, or "" on error.
@error: 1 if any of the arguments is not the type it should be, 2 if the result was not successful for any reason, 3 if the request worked but you don't have permission to edit that page.
Note: Make sure to specify a value for pageName, since frontpages
are usually locked!

_MediaWiki_Edit($site, $loginCookies, $token, $pageName, $text[, $pra = ""[, $section = ""[, $summary=""[, $captcha = ""]]]])
Example: _MediaWiki_Edit("http://www.mediawiki.org/w/api.php", $cookies, $token, "Sandbox", "Test edit!", "prepend", "0", "A test edit.")
Return Value: 1 on success, "" on failure.
@error: 1 if any of the arguments was not the type it should be, 2 if the edit was not successful for some reason.
Notes: $pra should be "prepend", "" for replace, or "append". Section should be a number
respresenting the section to edit, or 0 for the page itself, but it should be passed as a string. Really.
CAPTCHAs are not currently supported; that's just there for the future. For more info visit

If you give it a bad URL or one that does not exist, you will get a program-ending error. I'm far too lazy to fix this right now, but I'll try to figure something out in time for beta (if there ever is one).

If it gives you errors having to do with "$http.Open" or "$http.Send" and you're sure you have the url right, turn off your firewall; it's (probably) blocking the winhttprequest.object from making a connection.

Download the include:MediaWiki UDF's.au3


Edited by benzrf

Share this post

Link to post
Share on other sites

MediaWiki is the software that Wikipedia runs on, as well as every Wikia wiki, as well as most wikis besides.

Edited by benzrf

Share this post

Link to post
Share on other sites

Excellent work just what I was looking for.

What I need to do is remove the <tbody> </tbody> tags from all pages

if your library is able to do it, can you please give me the syntax, unless you know a better

way of getting rid of those tags( I am using KCEdit)

Thanks for your help,


Share this post

Link to post
Share on other sites


Sorry I'm responding a few months late; I had completely abandoned this thread and just randomly checked in for no real reason O.o

Anyway, thanks for the praise! If this isn't too late, I guess you could email me with more info... try "my name at my name.com". Sorry for being abstruse; I hate spam.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...