Tolkien Gateway

User:Mithbot/Scripts

(Difference between revisions)
m (Bot Message: changing link to Mardil)
m (Updated some more (shall finish this off later))
Line 200: Line 200:
 
*''<nowiki>[[Peregrin Took|Peregrin Took]]</nowiki>'' to [[Peregrin Took]] (16 October 2010);
 
*''<nowiki>[[Peregrin Took|Peregrin Took]]</nowiki>'' to [[Peregrin Took]] (16 October 2010);
 
*''<nowiki>[[Hobson|Hobson]]</nowiki>'' to [[Hobson]] (16 October 2010);
 
*''<nowiki>[[Hobson|Hobson]]</nowiki>'' to [[Hobson]] (16 October 2010);
 +
*''Witch-king of Angmar'', ''Witch King'', ''Lord of the Nazgûl'', ''Black Captain'' and ''Witch-King'' to [[Witch-king]]/[[Witch-king]] of [[Angmar]] (13 December 2010);
 +
*''Turgon of Gondolin'' and ''Turgon the Wise'' to [[Turgon]] (13 December 2010);
 +
*''Orodreth of Nargothrond'' to [[Orodreth]] (13 December 2010);
 +
*''Finduilas of Nargothrond'' to [[Finduilas]] (13 December 2010);
 +
*''Idril Celebrindal'' to [[Idril]] (14 December 2010);
 +
*''Finrod Felagund'' to [[Finrod]] (14 December 2010);
 +
*''Gil-Galad'', ''Gilgalad'', ''Ereinion Gil-galad'' to [[Gil-galad]] (14 December 2010);
 +
*''Tolkien'' to [[J.R.R. Tolkien]] (14 December 2010);
 +
*''The Lord of the Rings: The Battle for Middle-earth II: The Rise of the Witch King'' and ''EA's The Battle for Middle-earth II: The Rise of the Witch-king'' to [[The Lord of the Rings: The Battle for Middle-earth II: The Rise of the Witch-king]] (10 January 2011);
 +
*''Tolkien Gateway:Help'' to [[Help:Contents]] (10 January 2011);
 +
*''J. R. R. Tolkien'' to [[J.R.R. Tolkien]] (10 January 2011);
 +
*''S.'' to [[Sindarin]] (10 January 2011);
 +
*''Q.'' to [[Quenya]] (10 January 2011);
 +
*''Tolkien Gateway:Standards'' to [[Tolkien Gateway:Manual of Style]] (10 January 2011);
 +
*''Elf'' to [[Elves]] (10 January 2011);
 +
*''Aragorn II'' to [[Aragorn]] (10 January 2011);
 +
*''Orc'' to [[Orcs]] (10 January 2011);
 +
*''Hobbit'' to [[Hobbits]] (10 January 2011);
 +
*''Silmarillion'' to [[The Silmarillion]] (10 January 2011);
 +
*''Sam Gamgee'' to [[Samwise Gamgee]] (10 January 2011);
 +
*''House of Elrond'' to [[Rivendell]] (10 January 2011);
 +
*''Numenor'' to [[Númenor]] (10 January 2011);
 +
*''Shire'' to [[the Shire]] (10 January 2011);
 +
*''Dwarf'' to [[Dwarves]] (11 January 2011);
 +
*''ICE'' to [[Iron Crown Enterprises]] (11 January 2011);
 +
*''Vala'' to [[Valar]] (11 January 2011);
 +
*''Ñoldor'', ''Deep-elves'', ''Ñoldo'', to [[Noldor]] (11 January 2011);
 +
*''Nirnaeth Arnoediad'' to [[Nírnaeth Arnoediad]] (11 January 2011);
 +
*''Lúthien Tinúviel'' to [[Lúthien]] (12 January 2011);
 +
*''Elu Thingol'' to [[Thingol]] (13 January 2011);
 +
*''Mablung of the Heavy Hand'' to [[Mablung]] (13 January 2011);
 +
*''Tale of Years'' and ''The Tale of Years'' to [[Appendix B]] (14 January 2011);
 +
*''Boromir son of Denethor II'' to [[Boromir]] (14 January 2011);
 +
*''Minas Tirith in Gondor'' to [[Minas Tirith]] (14 January 2011);
 +
*''White Tower'' to [[Tower of Ecthelion]] (14 January 2011);
 +
*''Etymologies'' to [[The Etymologies]] (14 January 2011);
 +
*''Ringwraiths'', ''Ringwraith'', ''Winged Nazgûl'' and ''Nazgul'' to [[Nazgûl]] (14 January 2011);
 +
*''Mallorn journal'' to [[Mallorn (journal)]] (14 January 2011);
 +
*''Hithaeglir'' to [[Misty Mountains]] (14 January 2011);
 +
*''Hidden City'' to [[Gondolin]] (14 January 2011);
 +
*''Common Speech'' and ''Common Tongue'' to [[Westron]] (14 January 2011);
 +
*''Feanor'' to [[Fëanor]] (14 January 2011);
 +
*''Company of the Ring'' and ''Fellowship'' to [[Fellowship of the Ring]] (14 January 2011);
 +
*''Lothlorien'', ''Lórien in Middle-earth'', ''Laurelindórenan'' to [[Lothlórien]] (14 January 2011);
 +
 +
 +
==Changing Categories==
 +
*''Category:Images of Peter Jackson's The Return of the King'' and ''Category:Images from Peter Jackson's The Return of the King'' to [[:Category:Images from The Lord of the Rings: The Return of the King]] (17 November 2010);
 +
*''Category:Images from Peter Jackson's The Two Towers'' to [[:Category:Images from The Lord of the Rings: The Two Towers]] (17 November 2010);
 +
*''Category:Images from Peter Jackson's The Fellowship of the Ring'' to [[:Category:Images from The Lord of the Rings: The Fellowship of the Ring]] (17 November 2010);
 +
*''Category:Images of the Premiere of Peter Jackson's The Return of the King'' to [[:Category:Images from the premiere of The Lord of the Rings: The Return of the King]] (17 November 2010);
 +
*''Category:Images from Peter Jackson's The Lord of the Rings'' to [[:Category:Images from The Lord of the Rings: The Motion Picture Trilogy]] (17 November 2010)'
 +
*''Category:Images from Rankin/Bass' The Return of the King'' to [[:Category:Images from The Return of the King (1980 film)]] (18 November 2010);
 +
*''Category:Images from Rankin/Bass' The Hobbit'' to [[:Category:Images from The Hobbit (1977 film)]] (18 November 2010);
 +
*''Category:Images from Ralph Bakshi's The Lord of the Rings'' to [[:Category:Images from The Lord of the Rings (1978 film)]] (18 November 2010);
 +
*Added uncategorised book images to [[:Category:Images of Books]] (15 November 2010);

Revision as of 18:36, 20 February 2011

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:


Changing Categories