|
|
(10 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| __NOTOC__''Note: This code may need to be updated/amended before it can be used on different Wikis.''
| | ==Common scripts== |
| =Tolkien Gateway= | | ===Changing categories=== |
| ==Mass re-linking== | |
| <pre> | | <pre> |
| using System; | | using System; |
Line 7: |
Line 6: |
| class MyBot : Bot | | class MyBot : Bot |
| { | | { |
| public static void Main()
| | public static void Main() |
| {
| | { |
| Site site = new Site("http://tolkiengateway.net", "KingAragorn Bot", "PASSWORD");
| | Site site = new Site("http://tolkiengateway.net", "KingAragorn Bot", "PASSWORD"); |
|
| |
|
| | | PageList p = new PageList(site); |
| | | p.FillAllFromCategory("Vinyar Tengwar issues"); |
| PageList b = new PageList(site);
| | p.Load(); |
| b.FillFromFile("old.txt");
| | p.RemoveFromCategory("Vinyar Tengwar issues"); |
| foreach (Page c in b) {
| | p.AddToCategory("Vinyar Tengwar"); |
| PageList i = new PageList(site);
| | p.SaveSmoothly(1, "Bot comment: changed category.", true); |
| i.FillFromLinksToPage(c.title);
| | } |
|
| |
| foreach (Page p in i) {
| |
| i.Load();
| |
| p.text = p.text.Replace("[[MERP: Arnor, The Realm]]", "[[Arnor: The Realm]]");
| |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Assassins of Dol Amroth]]", "[[Assassins of Dol Amroth]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Bree and the Barrow-Downs]]", "[[Bree and the Barrow-Downs]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Brigands of Mirkwood]]", "[[Brigands of Mirkwood]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Calenhad, A Beacon of Gondor]]", "[[Calenhad: A Beacon of Gondor]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Creatures of Middle-earth]]", "[[Creatures of Middle-earth]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Creatures of Middle-earth (2nd edition)]]", "[[Creatures of Middle-earth (2nd edition)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Dagorlad and the Dead Marshes]]", "[[Dagorlad and the Dead Marshes]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Dark Mage of Rhudaur]]", "[[Dark Mage of Rhudaur]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Denizens of the Dark Wood]]", "[[Denizens of the Dark Wood]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Dol Guldur]]", "[[Dol Guldur (book)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Dunland and the Southern Misty Mountains]]", "[[Dunland and the Southern Misty Mountains]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Elves]]", "[[Elves (book)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Ents of Fangorn]]", "[[Ents of Fangorn]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Erech and the Paths of the Dead]]", "[[Erech and the Paths of the Dead]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Far Harad, The Scorched Land]]", "[[Far Harad: The Scorched Land]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Forest of Tears]]", "[[Forest of Tears]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Gates of Mordor]]", "[[Gates of Mordor (book)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Ghost Warriors]]", "[[Ghost Warriors]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Ghosts of the Southern Anduin]]", "[[Ghosts of the Southern Anduin]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Goblin-gate and Eagles' Eyrie]]", "[[Goblin-gate and Eagles' Eyrie]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Gorgoroth]]", "[[Gorgoroth (book)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Greater Harad]]", "[[Greater Harad]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Halls of the Elven-king]]", "[[Halls of the Elven-king]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Hands of the Healer]]", "[[Hands of the Healer]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Haunted Ruins of the Dunlendings]]", "[[Haunted Ruins of the Dunlendings]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Havens of Gondor]]", "[[Havens of Gondor]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Hazards of the Harad Wood]]", "[[Hazards of the Harad Wood]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Hillmen of the Trollshaws]]", "[[Hillmen of the Trollshaws]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Isengard and Northern Gondor]]", "[[Isengard and Northern Gondor]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Lake-town]]", "[[Lake-town (book)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Lord of the Rings Poster Map]]", "[[Lord of the Rings Poster Map]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Lords of Middle-earth Vol I]]", "[[Lords of Middle-earth: Vol. I]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Lords of Middle-earth Vol II]]", "[[Lords of Middle-earth: Vol. II]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Lords of Middle-earth Vol III]]", "[[Lords of Middle-earth: Vol. III]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Lost Realm of Cardolan]]", "[[Lost Realm of Cardolan]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Lórien and the Halls of the Elven Smiths]]", "[[Lórien and the Halls of the Elven Smiths]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Middle-earth Campaign Guide]]", "[[Middle-earth Campaign Guide]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Middle-earth Role Playing (2nd edition, hardcover)]]", "[[Middle-earth Role Playing (2nd edition, hardcover)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Middle-earth Role Playing (2nd edition, softcover)]]", "[[Middle-earth Role Playing (2nd edition, softcover)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Middle-earth Role Playing (boxed set)]]", "[[Middle-earth Role Playing (boxed set)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Middle-earth Role Playing Combat Screen and Reference Sheets]]", "[[Middle-earth Role Playing Combat Screen and Reference Sheets]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Middle-earth Role Playing Poster Maps]]", "[[Middle-earth Role Playing Poster Maps]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Middle-earth Role Playing - The Role Playing Game of J.R.R. Tolkien's World]]", "[[Middle-earth Role Playing: The Role Playing Game of J.R.R. Tolkien's World]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Middle-earth, The Role-playing Game set in J.R.R. Tolkien's World]]", "[[Middle-earth: The Role-playing Game set in J.R.R. Tolkien's World]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Minas Ithil]]", "[[Minas Ithil (book)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Minas Tirith]]", "[[Minas Tirith (1988 book)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Minas Tirith (2nd edition)]]", "[[Minas Tirith (1994 book)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Mirkwood (2nd edition)]]", "[[Mirkwood (MERP)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Moria (2nd edition)]]", "[[Moria (1994 book)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Moria, The Dwarven City]]", "[[Moria: The Dwarven City]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Mount Gundabad]]", "[[Mount Gundabad (book)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Mouths of the Entwash]]", "[[Mouths of the Entwash]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Nazgûl's Citadel]]", "[[Nazgûl's Citadel]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Northern Mirkwood (1983)]]", "[[Northern Mirkwood (1983)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Northern Mirkwood (1984)]]", "[[Northern Mirkwood (1984)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Northwestern Middle-earth Gazetteer]]", "[[Northwestern Middle-earth Gazetteer]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Northwestern Middle-earth Map Set]]", "[[Northwestern Middle-earth Map Set]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Palantír Quest]]", "[[Palantír Quest]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Perils on the Sea of Rhûn]]", "[[Perils on the Sea of Rhûn]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Phantom of the Northern Marches]]", "[[Phantom of the Northern Marches]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Pirates of Pelargir]]", "[[Pirates of Pelargir]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Raiders of Cardolan]]", "[[Raiders of Cardolan]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Rangers of the North]]", "[[Rangers of the North (book)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Riders of Rohan]]", "[[Riders of Rohan (1985 book)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Rivendell, The House of Elrond]]", "[[Rivendell: The House of Elrond]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: River Running]]", "[[River Running (book)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Rogues of the Borderlands]]", "[[Rogues of the Borderlands]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Sea-Lords of Gondor]]", "[[Sea-Lords of Gondor]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Shadow in the South]]", "[[Shadow in the South]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Southern Gondor, The Land]]", "[[Southern Gondor: The Land]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Southern Gondor, The People]]", "[[Southern Gondor: The People]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Southern Mirkwood]]", "[[Southern Mirkwood]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Teeth of Mordor]]", "[[Teeth of Mordor (book)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: The Court of Ardor]]", "[[The Court of Ardor]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: The Grey Mountains]]", "[[The Grey Mountains]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: The Kin-strife]]", "[[The Kin-strife]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: The Necromancer's Lieutenant]]", "[[The Necromancer's Lieutenant]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: The Northern Waste]]", "[[The Northern Waste]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: The Shire]]", "[[The Shire (book)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: The Tower of Cirith Ungol and Shelob's Lair]]", "[[The Tower of Cirith Ungol and Shelob's Lair]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Thieves of Tharbad]]", "[[Thieves of Tharbad]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Treasures of Middle-earth (2nd edition)]]", "[[Treasures of Middle-earth (2nd edition)]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Trolls of the Misty Mountains]]", "[[Trolls of the Misty Mountains]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Umbar, Haven of the Corsairs]]", "[[Umbar: Haven of the Corsairs]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Valar and Maiar]]", "[[Valar and Maiar]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Warlords of the Desert]]", "[[Warlords of the Desert]]");
| |
| | |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Weathertop, Tower of the Wind]]", "[[Weathertop: Tower of the Wind]]");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("[[MERP: Woses of the Black Wood]]", "[[Woses of the Black Wood]]");
| |
| | |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Arnor, The Realm|", "Arnor: The Realm|");
| |
| | |
| | |
| p.text = p.text.Replace("MERP: Assassins of Dol Amroth|", "Assassins of Dol Amroth|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Bree and the Barrow-Downs|", "Bree and the Barrow-Downs|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Brigands of Mirkwood|", "Brigands of Mirkwood|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Calenhad, A Beacon of Gondor|", "Calenhad: A Beacon of Gondor|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Creatures of Middle-earth|", "Creatures of Middle-earth|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Creatures of Middle-earth (2nd edition)|", "Creatures of Middle-earth (2nd edition)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Dagorlad and the Dead Marshes|", "Dagorlad and the Dead Marshes|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Dark Mage of Rhudaur|", "Dark Mage of Rhudaur|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Denizens of the Dark Wood|", "Denizens of the Dark Wood|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Dol Guldur|", "Dol Guldur (book)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Dunland and the Southern Misty Mountains|", "Dunland and the Southern Misty Mountains|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Elves|", "Elves (book)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Ents of Fangorn|", "Ents of Fangorn|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Erech and the Paths of the Dead|", "Erech and the Paths of the Dead|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Far Harad, The Scorched Land|", "Far Harad: The Scorched Land|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Forest of Tears|", "Forest of Tears|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Gates of Mordor|", "Gates of Mordor (book)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Ghost Warriors|", "Ghost Warriors|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Ghosts of the Southern Anduin|", "Ghosts of the Southern Anduin|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Goblin-gate and Eagles' Eyrie|", "Goblin-gate and Eagles' Eyrie|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Gorgoroth|", "Gorgoroth (book)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Greater Harad|", "Greater Harad|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Halls of the Elven-king|", "Halls of the Elven-king|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Hands of the Healer|", "Hands of the Healer|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Haunted Ruins of the Dunlendings|", "Haunted Ruins of the Dunlendings|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Havens of Gondor|", "Havens of Gondor|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Hazards of the Harad Wood|", "Hazards of the Harad Wood|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Hillmen of the Trollshaws|", "Hillmen of the Trollshaws|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Isengard and Northern Gondor|", "Isengard and Northern Gondor|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Lake-town|", "Lake-town (book)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Lord of the Rings Poster Map|", "Lord of the Rings Poster Map|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Lords of Middle-earth Vol I|", "Lords of Middle-earth: Vol. I|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Lords of Middle-earth Vol II|", "Lords of Middle-earth: Vol. II|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Lords of Middle-earth Vol III|", "Lords of Middle-earth: Vol. III|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Lost Realm of Cardolan|", "Lost Realm of Cardolan|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Lórien and the Halls of the Elven Smiths|", "Lórien and the Halls of the Elven Smiths|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Middle-earth Campaign Guide|", "Middle-earth Campaign Guide|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Middle-earth Role Playing (2nd edition, hardcover)|", "Middle-earth Role Playing (2nd edition, hardcover)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Middle-earth Role Playing (2nd edition, softcover)|", "Middle-earth Role Playing (2nd edition, softcover)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Middle-earth Role Playing (boxed set)|", "Middle-earth Role Playing (boxed set)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Middle-earth Role Playing Combat Screen and Reference Sheets|", "Middle-earth Role Playing Combat Screen and Reference Sheets|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Middle-earth Role Playing Poster Maps|", "Middle-earth Role Playing Poster Maps|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Middle-earth Role Playing - The Role Playing Game of J.R.R. Tolkien's World|", "Middle-earth Role Playing: The Role Playing Game of J.R.R. Tolkien's World|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Middle-earth, The Role-playing Game set in J.R.R. Tolkien's World|", "Middle-earth: The Role-playing Game set in J.R.R. Tolkien's World|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Minas Ithil|", "Minas Ithil (book)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Minas Tirith|", "Minas Tirith (1988 book)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Minas Tirith (2nd edition)|", "Minas Tirith (1994 book)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Mirkwood (2nd edition)|", "Mirkwood (MERP)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Moria (2nd edition)|", "Moria (1994 book)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Moria, The Dwarven City|", "Moria: The Dwarven City|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Mount Gundabad|", "Mount Gundabad (book)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Mouths of the Entwash|", "Mouths of the Entwash|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Nazgûl's Citadel|", "Nazgûl's Citadel|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Northern Mirkwood (1983)|", "Northern Mirkwood (1983)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Northern Mirkwood (1984)|", "Northern Mirkwood (1984)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Northwestern Middle-earth Gazetteer|", "Northwestern Middle-earth Gazetteer|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Northwestern Middle-earth Map Set|", "Northwestern Middle-earth Map Set|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Palantír Quest|", "Palantír Quest|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Perils on the Sea of Rhûn|", "Perils on the Sea of Rhûn|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Phantom of the Northern Marches|", "Phantom of the Northern Marches|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Pirates of Pelargir|", "Pirates of Pelargir|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Raiders of Cardolan|", "Raiders of Cardolan|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Rangers of the North|", "Rangers of the North (book)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Riders of Rohan|", "Riders of Rohan (1985 book)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Rivendell, The House of Elrond|", "Rivendell: The House of Elrond|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: River Running|", "River Running (book)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Rogues of the Borderlands|", "Rogues of the Borderlands|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Sea-Lords of Gondor|", "Sea-Lords of Gondor|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Shadow in the South|", "Shadow in the South|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Southern Gondor, The Land|", "Southern Gondor: The Land|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Southern Gondor, The People|", "Southern Gondor: The People|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Southern Mirkwood|", "Southern Mirkwood|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Teeth of Mordor|", "Teeth of Mordor (book)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: The Court of Ardor|", "The Court of Ardor|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: The Grey Mountains|", "The Grey Mountains|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: The Kin-strife|", "The Kin-strife|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: The Necromancer's Lieutenant|", "The Necromancer's Lieutenant|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: The Northern Waste|", "The Northern Waste|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: The Shire|", "The Shire (book)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: The Tower of Cirith Ungol and Shelob's Lair|", "The Tower of Cirith Ungol and Shelob's Lair|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Thieves of Tharbad|", "Thieves of Tharbad|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Treasures of Middle-earth (2nd edition)|", "Treasures of Middle-earth (2nd edition)|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Trolls of the Misty Mountains|", "Trolls of the Misty Mountains|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Umbar, Haven of the Corsairs|", "Umbar: Haven of the Corsairs|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Valar and Maiar|", "Valar and Maiar|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Warlords of the Desert|", "Warlords of the Desert|");
| |
| | |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Weathertop, Tower of the Wind|", "Weathertop: Tower of the Wind|");
| |
| | |
| | |
| | |
| p.text = p.text.Replace("MERP: Woses of the Black Wood|", "Woses of the Black Wood|");
| |
| | |
| | |
| | |
| i.SaveSmoothly(2, "Bot comment: fixing MERP links", true);
| |
| }
| |
| }
| |
| }
| |
|
| |
|
| } | | } |
| </pre> | | </pre> |
| Task history:
| |
| *Re-linked all links to correct MERP article rather than the redirect. (28/02/2011)
| |
| *Re-linked all articles to [[The Hobbit films]] rather than its redirects. (28/02/2011)
| |
|
| |
|
| ==Re-linking== | | ===Re-linking=== |
| <pre> | | <pre> |
| using System; | | using System; |
Line 751: |
Line 27: |
| class MyBot : Bot | | class MyBot : Bot |
| { | | { |
| public static void Main()
| | public static void Main() |
| {
| | { |
| Site site = new Site("http://tolkiengateway.net", "KingAragorn Bot", "PASSWORD");
| | Site site = new Site("http://tolkiengateway.net", "KingAragorn Bot", "PASSWORD"); |
| | |
| | PageList p = new PageList(site); |
| | p.FillFromLinksToPage("Erebor"); |
| | p.Load(); |
| | foreach (Page i in p) { |
| | i.text = i.text.Replace("[[Erebor]]", "[[Lonely Mountain|Erebor]]"); |
| | } |
| | |
| | foreach (Page j in p) { |
| | j.text = j.text.Replace("[[Erebor|Lonely Mountain]]", "[[Lonely Mountain]]"); |
| | } |
|
| |
|
| PageList p = new PageList(site);
| | p.SaveSmoothly(1, "Bot message: re-linked.", true); |
| p.FillFromCustomSpecialPage("Whatlinkshere/Of Beleriand and Its Realms", 500);
| | } |
| p.Load();
| |
| foreach (Page i in p)
| |
| i.text = i.text.Replace("Of Beleriand and Its Realms|", "Of Beleriand and its Realms|");
| |
| foreach (Page j in p)
| |
| j.text = j.text.Replace("[[Of Beleriand and Its Realms]]", "[[Of Beleriand and its Realms]]");
| |
| p.SaveSmoothly(3, "changing link to [[Of Beleriand and its Realms]]", true);
| |
| }
| |
|
| |
|
| } | | } |
| | </pre> |
|
| |
|
| | To avoid certain namespaces, add the following before p.Load(): |
| | <pre> |
| | p.RemoveNamespaces(new int[] {1,3}); |
| </pre> | | </pre> |
| Task history:
| |
| *''Peter Jackson's The Lord of the Rings'' to [[The Lord of the Rings: The Motion Picture Trilogy]] (2 July 2010)
| |
| *''J.R.R. Tolkien's War in Middle-Earth (1988 video game)'' to [[J.R.R. Tolkien's War in Middle Earth]] (2 July 2010)
| |
| *''Greek Tolkien Society'' to [[Ellinikós Sýllogos Philon Tólkin]] (2 July 2010)
| |
| *''Birthday Party'' to [[Bilbo's Farewell Party]] (3 July 2010)
| |
| *<s>''Of Beleriand and its Realms'' to '''Of Beleriand and Its Realms''' (3 July 2010)</s>
| |
| *''Of Beleriand and Its Realms'' to [[Of Beleriand and its Realms]] (20 January 2011)
| |
|
| |
|
| ==Changing categories==
| | To include specific namespaces only, add the following before p.Load(): |
| <pre> | | <pre> |
| using System;
| | p.FilterNamespaces(new int[] {1,3}); |
| using DotNetWikiBot;
| |
| class MyBot : Bot
| |
| {
| |
| public static void Main()
| |
| {
| |
| Site site = new Site("http://tolkiengateway.net", "KingAragorn Bot", "PASSWORD");
| |
| | |
| PageList p = new PageList(site);
| |
| p.FillAllFromCategory("Images of The Lord of the Rings: The White Council");
| |
| p.Load();
| |
| p.RemoveFromCategory("Images of The Lord of the Rings: The White Council");
| |
| p.AddToCategory("Images from The Lord of the Rings: The White Council");
| |
| p.SaveSmoothly(5, "Bot Comment: Changing Categories", true);
| |
| }
| |
| | |
| }
| |
| </pre> | | </pre> |
| | List of built-in namespaces and their corresponding integers: |
| | *0 - Main |
| | *1 - Talk |
| | *2 - User |
| | *3 - User talk |
| | *4 - Tolkien Gateway |
| | *5 - Tolkien Gateway talk |
| | *6 - File |
| | *7 - File talk |
| | *8 - MediaWiki |
| | *9 - MediaWiki talk |
| | *10 - Template |
| | *11 - Template talk |
| | *12 - Help |
| | *13 - Help talk |
| | *14 - Category |
| | *15 - Category talk |
|
| |
|
| =One Wiki to Rule them All= | | ==Irregular scripts== |
| | | ===Change image categories and automatically insert proper sort key=== |
| == Add Category to Recently Uploaded Images == | |
| <pre> | | <pre> |
| using System; | | using System; |
| | using System.IO; |
| | using System.Text; |
| | using System.Text.RegularExpressions; |
| | using System.Collections; |
| | using System.Xml; |
| using DotNetWikiBot; | | using DotNetWikiBot; |
| | using System.Threading; |
| | using System.Net; |
| | using System.Web; |
| | |
| class MyBot : Bot | | class MyBot : Bot |
| { | | { |
| public static void Main() | | public static void Main() |
| { | | { |
| Site site = new Site("http://tolkiengateway.net", "KingAragorn Bot", "PASSWORD"); | | Site site = new Site("http://tolkiengateway.net", "KingAragorn Bot", "PASSWORD"); |
| | |
| | PageList p = new PageList(site); |
| | p.FillSubsFromCategoryTree("Images"); |
| | p.FilterNamespaces(new int[] {14}); |
| | |
| | foreach(Page myPage in p) { |
| | String pagename1 = myPage.title; |
| | String pagename2 = pagename1.Replace("Category:", ""); |
| | String pagename3 = pagename2.Replace("Maps of ", ""); |
| | myPage.Load(); |
| | myPage.RemoveTemplate("DEFAULTSORT"); |
| | myPage.AddTemplate("{{DEFAULTSORT:" + pagename3 + "}}"); |
| | |
| | } |
| | p.SaveSmoothly(1, "Bot comment: fixed DEFAULTSORT.", true); |
| | } |
|
| |
|
| PageList p = new PageList(site);
| |
| p.FillFromCustomSpecialPage("Log/Upload", 29);
| |
| p.Load();
| |
| p.AddToCategory("Images of Tengwar");
| |
| p.SaveSmoothly(3, "Bot Comment: adding category", true);
| |
| }
| |
| } | | } |
|
| |
| </pre> | | </pre> |
|
| |
|
| == Removal of Spoiler Template from every page which has it == | | ===Mass re-linking=== |
| <pre> | | <pre> |
| using System; | | using System; |
Line 825: |
Line 120: |
| class MyBot : Bot | | class MyBot : Bot |
| { | | { |
| public static void Main() | | public static void Main() |
| { | | { |
| Site site = new Site("http://lotr.wikia.com", "KingAragorn Bot", "PASSWORD"); | | Site site = new Site("http://tolkiengateway.net", "KingAragorn Bot", "PASSWORD"); |
| PageList p = new PageList(site);
| |
| p.FillFromCustomSpecialPage("Whatlinkshere/Template:Spoiler", 500);
| |
| p.Load();
| |
| p.RemoveTemplate("Spoiler");
| |
| p.SaveSmoothly(3, "Bot Comment: removing spoiler template", true);
| |
| }
| |
| }
| |
| </pre>
| |
|
| |
|
| == Reverting a Vandal Accounts Contributions (not tested + needs rollback rights) == | | PageList b = new PageList(site); |
| <pre>
| | b.FillFromFile("PageList.txt"); |
| using System;
| | foreach (Page c in b) { |
| using DotNetWikiBot;
| | PageList i = new PageList(site); |
| | i.FillFromLinksToPage(c.title); |
| | i.LoadEx3(); |
| | foreach (Page p in i) { |
|
| |
|
| class MyBot : Bot
| | p.text = p.text.Replace("[[Rankin/Bass' The Hobbit]]", "[[The Hobbit (1977 film)]]"); |
| {
| | p.text = p.text.Replace("Rankin/Bass' The Hobbit|", "The Hobbit (1977 film)|"); |
| public static void Main()
| | p.text = p.text.Replace("[[Ralph Bakshi's The Lord of the Rings]]", "[[The Lord of the Rings (1978 film)]]"); |
| {
| | p.text = p.text.Replace("Ralph Bakshi's The Lord of the Rings|", "The Lord of the Rings (1978 film)|"); |
| Site enLOTR = new Site("http://lotr.wikia.com/wiki/", "KingAragorn Bot", "PASSWORD")
| | p.text = p.text.Replace("[[Rankin/Bass' The Return of the King]]", "[[The Return of the King (1980 film)]]"); |
| p.FillFromUserContributions ("VANDAL USERNAME" "500",);
| | p.text = p.text.Replace("Rankin/Bass' The Return of the King|", "The Return of the King (1980 film)|"); |
| p.Load();
| | p.Save("Bot comment: fixing links", true); |
| p.Revert("Bot Comment: Automatic Reverting of a vandal accounts contributions", false);
| | } |
| }
| |
| } | | } |
| </pre>
| | } |
|
| |
|
| == Adding the Stub template to all pages in [[Special:Shortpages]] ==
| | } |
| <pre>
| |
| using System;
| |
| using DotNetWikiBot;
| |
|
| |
|
| class MyBot : Bot
| |
| {
| |
| public static void Main()
| |
| {
| |
| Site enLOTR = new Site("http://lotr.wikia.com/wiki/", "KingAragorn Bot", "PASSWORD");
| |
| PageList p = new PageList(enLOTR);
| |
| p.FillFromCustomSpecialPage("Shortpages", 1000);
| |
| p.Load();
| |
| p.RemoveTemplate("stub");
| |
| p.AddTemplate("{{stub}}");
| |
| p.SaveSmoothly(5, "Bot Comment: Adding stub template - article is listed under [[Special:Shortpages]]", true);
| |
| }
| |
| }
| |
| </pre> | | </pre> |
|
| |
|
| == Changing Categories == | | ===Get list of article names and save to file=== |
| <pre> | | <pre> |
| using System; | | using System; |
| using DotNetWikiBot; | | using System.IO; |
| | using System.Text; |
| | using System.Text.RegularExpressions; |
| | using System.Collections; |
| | using System.Xml; |
| | using DotNetWikiBot; |
|
| |
|
| class MyBot : Bot | | class MyBot : Bot |
| {
| |
| public static void Main()
| |
| { | | { |
| Site enLOTR = new Site("http://lotr.wikia.com/wiki/", "KingAragorn Bot", "PASSWORD");
| | public static void Main() |
| PageList p = new PageList(enLOTR);
| | { |
| p.FillAllFromCategory("Mountains of Middle-earth");
| | Site site = new Site("http://tolkiengateway.net", "KingAragorn Bot", "********"); |
| p.load();
| | |
| p.RemoveFromCategory("Mountains of Middle-earth ")
| | site.fetchRate = 5000; |
| p.AddToCategory("Mountains")
| | |
| p.SaveSmoothly(5, "Bot Comment: Changing Categories", true)
| | PageList p = new PageList(site); |
| }
| | |
| | p.FillFromAllPages("The Tolkien Calendar 1993", 0 , false, 5000); |
| | |
| | p.SaveTitlesToFile("tg.txt"); |
| | } |
| } | | } |
| </pre> | | </pre> |
| | __NOTOC__ |