User:Mithbot/Scripts: Difference between revisions

From Tolkien Gateway
m (Updated some more (shall finish this off later))
(6 intermediate revisions by 3 users not shown)
Line 81: Line 81:
*''Anduril'' to [[Andúril]] (16 June 2010);
*''Anduril'' to [[Andúril]] (16 June 2010);
*''Eomer'' and ''Éomer Éadig'' to [[Éomer]] (16 June 2010);
*''Eomer'' and ''Éomer Éadig'' to [[Éomer]] (16 June 2010);
*''Dior'' and ''Dior Eluchil'' to [[Dior Eluchíl]] (16 June 2010);
*''Dior'' and ''Dior Eluchil'' to [[Dior|Dior Eluchíl]] (16 June 2010);
*''Elurin'' to [[Elurín]] (16 June 2010);
*''Elurin'' to [[Elurín]] (16 June 2010);
*''Elured'' to [[Eluréd]] (16 June 2010);
*''Elured'' to [[Eluréd]] (16 June 2010);
Line 159: Line 159:
*''Appendices'' and ''The Appendices'' to [[The Lord of the Rings Appendices]] (7 July 2010);
*''Appendices'' and ''The Appendices'' to [[The Lord of the Rings Appendices]] (7 July 2010);
*''North-kingdom'' to [[Arnor]] (7 July 2010);
*''North-kingdom'' to [[Arnor]] (7 July 2010);
*''Nirnaeth Arnoediad'' and ''Battle of Unnumbered Tears'' to [[Nírnaeth Arnoediad]] (5 August 2010);
*''Nirnaeth Arnoediad'' and ''Battle of Unnumbered Tears'' to [[Nirnaeth Arnoediad]] (5 August 2010);
*''Bëor the Old'' to [[Bëor]] (5 August 2010);
*''Bëor the Old'' to [[Bëor]] (5 August 2010);
*''Dragon'' to [[Dragons]] (5 August 2010);
*''Dragon'' to [[Dragons]] (5 August 2010);
Line 182: Line 182:
*''<nowiki>[[Category:Sandboxes| K]]</nowiki>'' to <nowiki>[[Category:Sandboxes|K]]</nowiki> (7 October 2010);
*''<nowiki>[[Category:Sandboxes| K]]</nowiki>'' to <nowiki>[[Category:Sandboxes|K]]</nowiki> (7 October 2010);
*''<nowiki>[[Category:Sandboxes]]</nowiki>'' to <nowiki>[[Category:Sandboxes|{{PAGENAME}}]]</nowiki> (7 October 2010);
*''<nowiki>[[Category:Sandboxes]]</nowiki>'' to <nowiki>[[Category:Sandboxes|{{PAGENAME}}]]</nowiki> (7 October 2010);
*''The Book of Lost Tales 1'' to [[The Book of Lost Tales Part 1]] (12 October 2010);
*''The Book of Lost Tales 1'' to [[The Book of Lost Tales Part One]] (12 October 2010);
*''The Book of Lost Tales 2'' and ''The Book of Lost Tales Party Two'' to [[The Book of Lost Tales Part 2]] (12 October 2010);
*''The Book of Lost Tales 2'' and ''The Book of Lost Tales Party Two'' to [[The Book of Lost Tales Part Two]] (12 October 2010);
*''Borondir Udalraph'' to [[Borondir]] (15 October 2010);
*''Borondir Udalraph'' to [[Borondir]] (15 October 2010);
*''<nowiki>[[Faramir|Faramir]]</nowiki>'' to [[Faramir]] (15 October 2010);
*''<nowiki>[[Faramir|Faramir]]</nowiki>'' to [[Faramir]] (15 October 2010);
Line 227: Line 227:
*''Vala'' to [[Valar]] (11 January 2011);
*''Vala'' to [[Valar]] (11 January 2011);
*''Ñoldor'', ''Deep-elves'', ''Ñoldo'', to [[Noldor]] (11 January 2011);
*''Ñoldor'', ''Deep-elves'', ''Ñoldo'', to [[Noldor]] (11 January 2011);
*''Nirnaeth Arnoediad'' to [[Nírnaeth Arnoediad]] (11 January 2011);
*''Nirnaeth Arnoediad'' to [[Nirnaeth Arnoediad]] (11 January 2011);
*''Lúthien Tinúviel'' to [[Lúthien]] (12 January 2011);
*''Lúthien Tinúviel'' to [[Lúthien]] (12 January 2011);
*''Elu Thingol'' to [[Thingol]] (13 January 2011);
*''Elu Thingol'' to [[Thingol]] (13 January 2011);
Line 243: Line 243:
*''Feanor'' to [[Fëanor]] (14 January 2011);
*''Feanor'' to [[Fëanor]] (14 January 2011);
*''Company of the Ring'' and ''Fellowship'' to [[Fellowship of the Ring]] (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);
*''Lothlorien'', ''Lórien in Middle-earth'' and ''Laurelindórenan'' to [[Lothlórien]] (14 January 2011);
 
*''War of the Jewels'' to [[The War of the Jewels]] (14 January 2011);
*''Great River'' to [[Anduin]] (14 January 2011);
*''Balrog'' to [[Balrogs]] (14 January 2011);
*''MECCG'' to [[Middle-earth Collectible Card Game]] (14 January 2011);
*''MERP'' to [[Middle-earth Role Playing]] (14 January 2011);
*''Lord of the Rings Online'' and ''LOTRO'' to [[The Lord of the Rings Online]] (14 January 2011);
*''Nomenclature'' and ''Nomenclature of The Lord of the Rings'' to [[Guide to the Names in The Lord of the Rings]] (14 January 2011);
*''Beren Erchamion'' to [[Beren]] (14 January 2011);
*''Theoden'' to [[Théoden]] (14 January 2011);
*''Túrin Turambar'' to [[Túrin]] (14 January 2011);
*''Gondorian'' to [[Gondorians]] (14 January 2011);
*''Sinda'' to [[Sindar]] (14 January 2011);
*''History of Middle-earth'' to [[The History of Middle-earth]] (14 January 2011);
*''One Ring'', ''Ruling Ring'' and ''The Ring'' to [[the One Ring]] (14 January 2011);
*''Great Sea'' to [[Belegaer]] (14 January 2011);
*''Greenwood'', ''Greenwood the Great'' and ''Eryn Galen'' to [[Mirkwood]] (14 January 2011);
*''Tolkien Society'' to [[The Tolkien Society]] (14-15 January 2011);
*''Three Houses of the Edain'' and ''Three Houses'' to [[Edain]] (15 January 2011);
*''Tower of Orthanc'' to [[Orthanc]] (15 January 2011);
*''Noldofinwë'' to [[Fingolfin]] (15 January 2011);
*''Template:Gondorian'' to [[Template:gondorian infobox]] (15 January 2011);
*''Mardil Voronwë'' to [[Mardil]] (31 January 2011);
*''Húrin the Tall'' to [[Húrin (Warden of the Keys)]] (1 February 2011);
*''Celeborn, Lord of Lórien'' and ''Celeborn (Lord of Lórien)'' to [[Celeborn]] (20 February 2011);


==Changing Categories==
==Changing Categories==
Line 251: Line 274:
*''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 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 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 Peter Jackson's The Lord of the Rings'' to {{Redlink|[[: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 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 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);
*''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);
*Added uncategorised book images to [[:Category:Images of books]] (15 November 2010);

Revision as of 11:58, 14 July 2013

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

Category:Images from The Lord of the Rings: The Motion Picture Trilogy[former link] (17 November 2010)'