1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

DotNetWikiBot Framework

From dotnetwikibot

(Redirected from Main Page)
Jump to: navigation, search

Purpose

DotNetWikiBot Framework is designed to help with many complicated and routine tasks of wiki site development and maintenance. DotNetWikiBot Framework is a clean full-featured client API, that allows you to build programs and web robots easily to manage information on MediaWiki-powered sites. DotNetWikiBot Framework is also good for learning C# and .NET.

Some facts about DotNetWikiBot Framework

  • DotNetWikiBot Framework is an easy-to-learn and easy-to-use library (API) for programming client applications and web robots, that could help in construction and maintenance of wiki sites.
  • DotNetWikiBot is compiled as a .NET dynamic link library (.dll file), that could be used directly or in other products.
  • DotNetWikiBot is written in C#, based on Microsoft® .NET Framework 3.5 and targets the sites running free MediaWiki software.
  • Using Mono framework, DotNetWikiBot can work under Linux, BSD, Solaris, Mac OS X and iPhone OS as well as under Windows.
  • Any .NET language can be used to access DotNetWikiBot library functions, including Visual Basic, Managed C++, JScript, J# and F#. Only minimal programming skills are required to make bots with DotNetWikiBot Framework, it allows to build bots in fast and simple manner.
  • DotNetWikiBot source code is located in a single .cs file, that could be easily changed and recompiled to suite your needs. It requires only C# compiler, no other tools.
  • DotNetWikiBot Framework is good for educational purposes. It's source code is written in a plain classic manner, allowing to learn object-oriented programming, .NET features, LINQ, web robots making, regular expressions and advanced XML parsing in a short time.
  • DotNetWikiBot doesn't require installation. It is downloaded in a single small .zip file along with compiled documentation, source codes, compilation batch file, sample GUI Utility for batch upload of files to wiki sites and ready-to-use sample bot script.
  • DotNetWikiBot is free.

Short tutorial

There are only 3 types of objects in DotNetWikiBot Framework: Site, Page and PageList. They are used as follows.

 
using DotNetWikiBot;	// Reference DotNetWikiBot namespace for easy access
 
class MyBot : Bot	// Derive your bot class from framework's Bot class
{
   public static void Main()
   {
       // Firstly make Site object, specifying site's URL and your bot account
       Site enWiki = new Site("http://en.wikipedia.org", "myBotLogin", "myPassword");
       // Then make Page object, specifying site and page title in constructor
       Page p = new Page(enWiki, "Art");
       // Load actual page text from live wiki
       p.Load();
       // Add "Visual arts" category link to "Art" page's text
       p.AddToCategory("Visual arts");
       // Save "Art" article's text back to live wiki with specified comment
       p.Save("comment: category link added", true);
 
       // Make empty PageList object, representing collection of pages
       PageList pl = new PageList(enWiki);
       // Fill it with 100 pages, where "nuclear disintegration" is mentioned
       pl.FillFromGoogleSearchResults("nuclear disintegration", 100);
       // Load texts and metadata of all found pages from live wiki
       pl.LoadWithMetadata();
       // Now suppose, that we must correct some typical mistake in all our pages
       foreach (Page i in pl)
           // In each page we will replace one phrase with another
           i.text = i.text.Replace("fusion products", "fission products");
       // Finally we'll save all changed pages to wiki with 5 seconds interval			
       pl.SaveSmoothly(5, "comment: mistake autocorrection", true);
 	
       // Now clear our PageList so we could re-use it
       pl.Clear();
       // Fill it with all articles in "Astronomy" category and it's subcategories
       pl.FillFromCategoryTree("Astronomy");
       // Download and save all PageList's articles to specified local XML file
       pl.SaveXmlDumpToFile("Dumps\\ArticlesAboutAstronomy.xml");		
   }
 }

More examples

A very compehensive DotNetWikiBot usage examples can be found in unit testing file called DebugBot.cs.

Bot scripts repository is being created. You are welcome to share your scripts.

Very detailed compiled documentation is supplied in DotNetWikiBot package and now is also available online.

Working with SourceForge wikis

In version 2.8 of DotNetWikiBot Framework the support for SourceForge user authentication was added. With that feature DotNetWikiBot can now be used to develop and maintain SourceForge-hosted MediaWiki installations, that are usually available at https://sourceforge.net/apps/mediawiki/PROJECT_NAME/, like the wiki you are seeing now.

Standard login function syntax is valid for SourceForge wikis:

Site site = new Site("https://sourceforge.net/apps/mediawiki/PROJECT_NAME/",
    "YourSourceForgeLogin", "YourSourceForgePassword");

Personal tools