User:KingAragorn Bot/Scripts: Difference between revisions
From Tolkien Gateway
KingAragorn (talk | contribs) |
KingAragorn (talk | contribs) (→Mass re-linking: fixing bug in code) |
||
Line 20: | Line 20: | ||
foreach (Page p in i) { | foreach (Page p in i) { | ||
i. | i.LoadEx3(); | ||
p.text = p.text.Replace("[[MERP: Arnor, The Realm]]", "[[Arnor: The Realm]]"); | p.text = p.text.Replace("[[MERP: Arnor, The Realm]]", "[[Arnor: The Realm]]"); | ||
Revision as of 23:17, 28 March 2011
Note: This code may need to be updated/amended before it can be used on different Wikis.
Tolkien Gateway
Mass re-linking
using System; using DotNetWikiBot; class MyBot : Bot { public static void Main() { Site site = new Site("http://tolkiengateway.net", "KingAragorn Bot", "PASSWORD"); PageList b = new PageList(site); b.FillFromFile("old.txt"); foreach (Page c in b) { PageList i = new PageList(site); i.FillFromLinksToPage(c.title); foreach (Page p in i) { i.LoadEx3(); 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); } } } }
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
using System; 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.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); } }
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)
Of Beleriand and its Realms to Of Beleriand and Its Realms (3 July 2010)- Of Beleriand and Its Realms to Of Beleriand and its Realms (20 January 2011)
Changing categories
using System; 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); } }
One Wiki to Rule them All
Add Category to Recently Uploaded Images
using System; 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.FillFromCustomSpecialPage("Log/Upload", 29); p.Load(); p.AddToCategory("Images of Tengwar"); p.SaveSmoothly(3, "Bot Comment: adding category", true); } }
Removal of Spoiler Template from every page which has it
using System; using DotNetWikiBot; class MyBot : Bot { public static void Main() { Site site = new Site("http://lotr.wikia.com", "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); } }
Reverting a Vandal Accounts Contributions (not tested + needs rollback rights)
using System; using DotNetWikiBot; class MyBot : Bot { public static void Main() { Site enLOTR = new Site("http://lotr.wikia.com/wiki/", "KingAragorn Bot", "PASSWORD") p.FillFromUserContributions ("VANDAL USERNAME" "500",); p.Load(); p.Revert("Bot Comment: Automatic Reverting of a vandal accounts contributions", false); } }
Adding the Stub template to all pages in Special:Shortpages
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); } }
Changing Categories
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.FillAllFromCategory("Mountains of Middle-earth"); p.load(); p.RemoveFromCategory("Mountains of Middle-earth ") p.AddToCategory("Mountains") p.SaveSmoothly(5, "Bot Comment: Changing Categories", true) } }