User:TalBot/horseshoe-delete.py
Appearance
#! /usr/bin/env python
# _*_ coding: utf8 _*_
#
# Deletes certain pages created from faulty "Horse shoes and horse shoeing.djvu"
#
# Copyright © 2011, GrafZahl (en.wikisource.org user)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# Use the standard args -log and -putthrottle
#
import wikipedia
# Handle args
args = wikipedia.handleArgs()
for arg in args:
wikipedia.output('(WWW) Ignoring unhanled arg %s' % arg)
# Basic text tokens
summary = u'Bulk deletion per [[WS:CSD]] G7: author\'s request, see [[WS:BR#Mass_deletion_of_not-proofread_pages]]'
base_title = u'Page:Horse shoes and horse shoeing.djvu/%d'
page_range = range(62, 380)
# Delete the pages
site = wikipedia.getSite()
for pagenumber in page_range:
try:
title = base_title % pagenumber
wikipedia.output(u'(III) Deleting page [[%s]]' % title)
page = wikipedia.Page(site, title)
page.delete(summary)
except wikipedia.Error, theerror:
wikipedia.output(u'(EEE) Unable to delete page no. %d because of: %s' % (pagenumber, theerror))