Tolkien Gateway

User:Mithbot/Scripts

(Difference between revisions)
m (Added more jobs)
m (Added more jobs)
Line 65: Line 65:
 
*''Barahir grandson of Faramir'' to [[Barahir (grandson of Faramir)]] (15 June 2010);
 
*''Barahir grandson of Faramir'' to [[Barahir (grandson of Faramir)]] (15 June 2010);
 
*''Boromir son of Denethor II'', ''Boromir II'', ''Boromir, son of Denethor II'' ''Boromir (son of Denethor II)'' to [[Boromir]] (15 June 2010);
 
*''Boromir son of Denethor II'', ''Boromir II'', ''Boromir, son of Denethor II'' ''Boromir (son of Denethor II)'' to [[Boromir]] (15 June 2010);
 +
*''Míriel of Númenor'' to [[Tar-Míriel]] (15 June 2010);
 +
*''Veantur'' to [[Vëantur]] (15 June 2010);
 +
*''Ar-Gimilzor'' and ''Gimilzôr'' to [[Ar-Gimilzôr]] (15 June 2010);
 +
*''Herunúmen'' to [[Tar-Herunúmen]] (15 June 2010);
 +
*''Beruthiel'' and ''Queen Berúthiel'' to [[Berúthiel]] (15 June 2010);
 +
*''Tar-Calion'', ''Pharazôn'' and ''Ar-Pharazon'' to [[Ar-Pharazôn]] (16 June 2010);
 +
*''Numenor'' to [[Númenor]] (16 June 2010);
 +
*''Black Numenoreans'' and ''Black Númenórean'' to [[Black Númenóreans]] (16 June 2010);
 +
*''Númenoreans'', ''Númenórean'', ''Men of Númenor'', ''Númenorean'' and ''Numenoreans'' to [[Númenóreans]] (16 June 2010);
 +
*''Adunaic'' to [[Adûnaic]] (16 June 2010);
 +
*''Akallabeth'', ''Downfall of Numenor'', ''Drowning of Númenor'' and ''The Akallabêth'' to [[Akallabêth]] (16 June 2010);
 +
*''Anarion'' and ''Anárion son of Elendil'' to [[Anárion]] (16 June 2010);
 +
*''Lord of Andúnië'' to [[Lords of Andúnië]] (16 June 2010);
 +
*''Andune'' to [[Andúnië]] (16 June 2010);
 +
*''Anduril'' to [[Andúril]] (16 June 2010);
 +
*''Eomer'' and ''Éomer Éadig'' to [[Éomer]] (16 June 2010);
 +
*''Dior'' and ''Dior Eluchil'' to [[Dior Eluchíl]] (16 June 2010);
 +
*''Elurin'' to [[Elurín]] (16 June 2010);
 +
*''Elured'' to [[Eluréd]] (16 June 2010);
 +
*''Man of the West'', ''Men of the West'', ''Núnatani'', ''Núnatan'', ''Dúnadan'', ''Dunadan'' and ''Dunedain'' to [[Dúnedain]] (16 June 2010);
 +
*''Lothiriel'' to [[Lothíriel]] (16 June 2010);
 +
*''Ghan-buri-Ghan'' to [[Ghân-buri-Ghân]] (16 June 2010);
 +
*''Old Púkel land'' to [[Drúwaith Iaur]] (16 June 2010);
 +
*''Drúath'', ''Drughu'', ''Drûgs'', ''Drûg'', ''Drúadan'' and ''Druadan'' to [[Drúedain]] (16 June 2010);
 +
*''Barahir son of Bregor'' to [[Barahir]] (16 June 2010);
 +
*''Baranor son of Baran'' to [[Baranor (son of Baran)]] (16 June 2010);
 +
*''Beren son of Belemir'' to [[Beren (son of Belemir)]] (16 June 2010);
 +
*''Elros Tar-Minyatur'' and ''Tar-Minyatur'' to [[Elros]] (17 June 2010);
 +
*''Earendil'' and ''Eärendil the Mariner'' to [[Eärendil]] (17-8 June 2010);
 +
*''Brandir of Arachon'' to [[Brandir (son of Arachon)]] (18 June 2010);
 +
*''Rian'' to [[Rían]] (18 June 2010);
 +
*''Third House of the Edain'', ''People of Hador'', ''Third House'' and ''House of Marach'' to [[House of Hador]] (18 June 2010);
 +
*''Malach Aradan'' to [[Malach]] (18 June 2010);
 +
*''Dunlending language'' to [[Dunlendish]] (20 June 2010);
 +
*''Haleth the Hunter' to [[Haleth]] (20 June 2010);
 +
*''Túrin Turambar'', ''Turin'' and ''Turindo'' to [[Túrin]] (20 June 2010);
 +
*''Morwen Eledhwen'' to [[Morwen]] (20 June 2010);
 +
*''Húrin Thalion'' to [[Húrin]] (20 June 2010);

Revision as of 21:24, 20 June 2010

Changing Internal Links

using System;
using DotNetWikiBot;
class MyBot : Bot 
{ 
	public static void Main() 
	{ 
		Site site = new Site("http://tolkiengateway.net", "Mithbot", "PASSWORD"); 

		PageList p = new PageList(site);
 		p.FillFromLinksToPage("Bilbo");
		p.LoadEx();
		foreach (Page i in p)
			i.text = i.text.Replace("[[Bilbo]]", "[[Bilbo Baggins]]");
		p.SaveSmoothly(1, "Bot Message: changing link to [[Bilbo Baggins]]", true);
	} 

}

To avoid certain namespaces, add this before p.LoadEx();, User and Template in this example:-

		p.RemoveNamespaces(new int[] {2,10});

The above code is used to change links to a particular page in order to remove redirects. By changing "Bilbo" and "Bilbo Baggins" this script can be re-used again and again to edit internal links. So far, it has been used for changing: