Hoppa till innehållet

Wikipedia:Projekt DotNetWikiBot Framework/GameOnBot/Syntaxfel/021 - English category

Från Wikipedia
//Originally made by sv:Användare:GameOn in 2011
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Xml;
using DotNetWikiBot;
using System.Threading;
using System.Net;
using System.Web;

class MyBot : Bot
{
	public static void Main()
	{
		Site     site                = new Site(wiki, user, password);
		String   editCommentStr      = "Syntaxfix Category: -> Kategorien";
		String   orgStr;
		PageList pl                  = new PageList(site);

		pl.FillFromFile("test1.txt");
		pl.FilterNamespaces(new int[] {0});
		pl.RemoveRecurring();
		foreach(Page myPage in pl)
		{
			myPage.Load();
			orgStr = myPage.text;
			myPage.text = myPage.text.Replace("[[Category:", "[[Kategorie:");
			if(myPage.text != orgStr)
			{
				myPage.Save(myPage.text, editCommentStr, true);
				Thread.Sleep(60000);
			}
		}
	}
}