Tolkien Gateway

Tolkien Gateway is 10 years old. Sign up today to edit TG and help us grow for years to come.

User:Mithbot/Scripts

< User:Mithbot(Difference between revisions)
m (Bot: Re-linked Dior Eluchíl)
m (redlinks)
 
(2 intermediate revisions by 2 users not shown)
Line 32: Line 32:
 
*''Tarondor of Gondor'' to [[Tarondor (King of Gondor)]] (14 June 2010);
 
*''Tarondor of Gondor'' to [[Tarondor (King of Gondor)]] (14 June 2010);
 
*''Calimehtar, King of Gondor'' to [[Calimehtar (King of Gondor)]] (14 June 2010);
 
*''Calimehtar, King of Gondor'' to [[Calimehtar (King of Gondor)]] (14 June 2010);
*''Amandil of Andúnië'' to [[Amandil (Lord of Andúnië)]] (14 June 2010);
+
*''Amandil of Andúnië'' to {{redlink|[[Amandil (Lord of Andúnië)]]}} (14 June 2010);
 
*''Anárion son of Elendil'' to [[Anárion]] (14 June 2010);
 
*''Anárion son of Elendil'' to [[Anárion]] (14 June 2010);
 
*Changing "||" to "|" - fixing own mistake (15 June 2010);
 
*Changing "||" to "|" - fixing own mistake (15 June 2010);
Line 61: Line 61:
 
*''Orodreth of Gondor'' to [[Orodreth (Steward of Gondor)]] (15 June 2010);
 
*''Orodreth of Gondor'' to [[Orodreth (Steward of Gondor)]] (15 June 2010);
 
*''Turgon of Gondor'' to [[Turgon (Steward of Gondor)]] (15 June 2010);
 
*''Turgon of Gondor'' to [[Turgon (Steward of Gondor)]] (15 June 2010);
*''Baranor of Gondor'' to [[Baranor (Man of Gondor)]] (15 June 2010);
+
*''Baranor of Gondor'' to {{redlink|[[Baranor (Man of Gondor)]]}} (15 June 2010);
 
*''Beregond, soldier of Gondor'' to [[Beregond (soldier of Gondor)]] (15 June 2010);
 
*''Beregond, soldier of Gondor'' to [[Beregond (soldier of Gondor)]] (15 June 2010);
 
*''Barahir grandson of Faramir'' to [[Barahir (grandson of Faramir)]] (15 June 2010);
 
*''Barahir grandson of Faramir'' to [[Barahir (grandson of Faramir)]] (15 June 2010);
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|Dior Eluchíl]] (16 June 2010);
+
*''Dior'' and ''Dior Eluchil'' to {{redlink|[[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 176: Line 176:
 
*''Minas Tirith of Gondor'' to [[Minas Tirith]] (3 September 2010);
 
*''Minas Tirith of Gondor'' to [[Minas Tirith]] (3 September 2010);
 
*Categorisation of uncategorised TG images and meeting templates (3 September 2010);
 
*Categorisation of uncategorised TG images and meeting templates (3 September 2010);
*''Image:Maedhros_sketch.jpeg'' to [[:Image:Ivanneth Maedhros.jpg]] (21 September 2010);
+
*''Image:Maedhros_sketch.jpeg'' to {{redlink|[[Image:Ivanneth Maedhros.jpg]]}} (21 September 2010);
 
*''Category:Tolkien Gateway:Users'' to [[:Category:Gatekeepers]] (7 October 2010);
 
*''Category:Tolkien Gateway:Users'' to [[:Category:Gatekeepers]] (7 October 2010);
 
*''Category:User lore-3'' to <nowiki>[[Category:User lore-3|{{PAGENAME}}]]</nowiki> (7 October 2010);
 
*''Category:User lore-3'' to <nowiki>[[Category:User lore-3|{{PAGENAME}}]]</nowiki> (7 October 2010);
Line 273: Line 273:
 
*''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 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 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 {{redlink|[[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);

Latest revision as of 15:46, 1 June 2015

[edit] 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:

[edit] Changing Categories

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