User:Mithbot/Scripts
From Tolkien Gateway
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); } }
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:
- Bilbo to Bilbo Baggins (14 June 2010);