Luasóg is a JavaScript framework for interacting with the MediaWiki API. It can be used to write JavaScript programs ('bots') that can log in, read and edit websites that use MediaWiki, a wiki software used by sites such as Wikipedia. The latest version of Luasóg is version 0.3. Version 0.3 should still be considered a development release.
The Luasóg project also includes a desktop-based integrated development environment (IDE) for writing and executing scripts that use the Luasóg framework. The IDE is written using Adobe Flex and so can run on any operating system that has the Adobe Air runtimes installed. This IDE implements some useful JavaScript functions that are seperate from the Luasóg framework.
To get the Luasóg framework or IDE, download it from SourceForge.net. Outside of the IDE, the Luasóg API is requires the jQuery framework.


The Luasóg framework API consists of a single class: the Luasog class. The IDE implements some IDE-specific functions, such as trace, error and stop. The Luasóg framework API is documented here. The IDE-specific functions are documented here.
Using the Luasog class, bots are implemented using a series of calls and callbacks. For example:
var my_bot = new Luasog("http://en.wikipedia.org/w/api.php");
var callback = function(success, result){
if (!success) { error(result.info); }
else {
trace(result.content);
}
stop();
};
my_bot.get({page:"Main Page"}, callback);
In the above example, a Luasóg-based bot (my_bot) calls the English-language Wikipedia API (http://en.wikipedia.org/w/api.php). It requests the contents of a page called 'Main Page' (my_bot.get({page:"Main Page"}, ...)). On completion of this request, a function (callback) is called.
If the first argument of this function (success) is true then the request was completed successfully. In that event, the second argument (result) contains information about the Main Page, including its content (result.content). The content is written to the output window (trace(result.content);).
If the request was unsuccessful then the first argument of the function (success) will be false and the second arugment will contain information about the what went wrong (result.info). In that event, a description of the error is written to the output window as an error (error(result.info);).
Regardles of whether the request was successful or not the script is then stopped (stop();).
Scripts executed using the IDE send a specific UserAgent HTTP header with their requests. By identifying this header, website owners can limit access to their website for scripts executed using the Luasóg IDE:
Luasog/0.3; using AppleWebKit (KHTML, like Gecko); contact details at http://sourceforge.net/projects/luasog/
The version number in this User-Agent header (0.3) will imcrement each relase and was first implemented in version 0.2.
Luasóg - A JavaScript framework for accessing the MediaWiki API.
Copyright © 2010 Oliver Moran
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
The Luasóg IDE integrates JSLint-based syntax checker, CodeMirror-based syntax highlighting and tidying and the Luasóg API requires the jQuery framework. The robot icon used by Luasóg was designed in 2006 by Bilboq and is from the Wikimedia Commons.