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); } }
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:
- Bilbo to Bilbo Baggins (14 June 2010);
- Siriondil of Gondor to Siriondil (King of Gondor) (14 June 2010);
- Calmacil of Gondor to Calmacil (King of Gondor) (14 June 2010);
- Cemendur of Gondor to Cemendur (King of Gondor) (14 June 2010);
- Eärendil of Gondor to Eärendil (King of Gondor) (14 June 2010);
- Anardil of Gondor to Anardil (King of Gondor) (14 June 2010);
- Turambar of Gondor to Turambar (King of Gondor) (14 June 2010);
- Eldacar of Gondor to Eldacar (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);
- Amandil of Andúnië to Amandil (Lord of Andúnië) (14 June 2010);
- Anárion son of Elendil to Anárion (14 June 2010);
- Changing "||" to "|" - fixing own mistake (15 June 2010);
- Eärendur, Lord of Andúnië to Eärendur (Lord of Andúnië) (15 June 2010);
- Valandil of Númenor to Valandil (Lord of Andúnië) (15 June 2010);
- Silmarien to Silmariën (15 June 2010);
- Ardamir son of Axantur to Ardamir (son of Axantur) (15 June 2010);
- Eärendur, son of Tar-Amandil to Eärendur (son of Tar-Amandil) (15 June 2010);
- Cemendur of Númenor to Cemendur (son of Axantur) (15 June 2010);
- Aulendil of Númenor to Aulendil (son of Vardamir) (15 June 2010);
- Eärendur, King of Arnor to Eärendur (King of Arnor) (15 June 2010);
- Elendur, son of Isildur to Elendur (son of Isildur) (15 June 2010);
- Elendur, King of Arnor to Elendur (King of Arnor) (15 June 2010);
- Tarondor of Arnor to Tarondor (King of Arnor) (15 June 2010);
- Valandil of Arnor to Valandil (King of Arnor) (15 June 2010);
- Eldacar of Arnor to Eldacar (King of Arnor) (15 June 2010);
- Beleg of Arthedain to Beleg (King of Arthedain) (15 June 2010);
- Faramir son of Ondoher to Faramir (son of Ondoher) (15 June 2010);
- Beregond, Steward of Gondor to Beregond (Steward of Gondor) (15 June 2010);
- Boromir I and Boromir son of Denethor I to Boromir (Steward of Gondor) (15 June 2010);
- Dior of Gondor to Dior (Steward of Gondor) (15 June 2010);
- Steward Cirion to Cirion (15 June 2010);
- Barahir son of Hador to Barahir (Steward of Gondor) (15 June 2010);
- Hador of Gondor to Hador (Steward of Gondor) (15 June 2010);
- Egalmoth, Steward of Gondor to Egalmoth (Steward of Gondor) (15 June 2010);
- Faramir son of Denethor II, Faramir, son of Denethor II and Faramir (son of Denethor II) to Faramir (15 June 2010);
- Mardil to Mardil Voronwë (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);
- Baranor of Gondor to Baranor (Man 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);
- 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);