account needed. Note: the script requires the Python IRC library http://python-irclib.sourceforge.net/ """ # Author: Balasyum # http://hu.wikipedia.org/wiki/User:Balasyum # License : LGPL __version__ = '$Id: 2f3bda66e7dbb983f6c69dbb6829c3ed63bebe2b $' import re import wikipedia as pywikibot import externals externals.check_setup('irclib') from ircbot import SingleServerIRCBot from irclib import nm_to_n, nm_to_h, irc_lower, ip_numstr_to_quad from irclib import ip_quad_to_numstr class ArtNoDisp(SingleServerIRCBot): def __init__(self, site, channel, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel self.site = site ns = [] for n in site.namespaces(): if type(n) == type(()): ns += n[0] else:
A second use is to get a number of images that have URLs only differing in numbers. To do this, use the command line option "-pattern", and give the URL with the variable part replaced by '$' (if that character occurs in the URL itself, you will have to change the bot code, my apologies). Other options: -shown Choose images shown on the page as well as linked from it -justshown Choose _only_ images shown on the page, not those linked """ __version__='$Id: imageharvest.py 11746 2013-07-12 20:22:37Z drtrigon $' import re, sys, os import wikipedia as pywikibot import externals # check for and install needed externals.check_setup('BeautifulSoup.py') # 'externals' import urllib import BeautifulSoup import upload def get_imagelinks(url): """Given a URL, get all images linked to by the page at that URL.""" links = [] uo = pywikibot.MyURLopener file = uo.open(url) soup = BeautifulSoup.BeautifulSoup(file.read()) file.close() if not shown: tagname = "a" elif shown == "just":
account needed. Note: the script requires the Python IRC library http://python-irclib.sourceforge.net/ """ # Author: Balasyum # http://hu.wikipedia.org/wiki/User:Balasyum # License : LGPL __version__ = '$Id: 2f3bda66e7dbb983f6c69dbb6829c3ed63bebe2b $' import re import wikipedia as pywikibot import externals externals.check_setup('irclib') from ircbot import SingleServerIRCBot from irclib import nm_to_n, nm_to_h, irc_lower, ip_numstr_to_quad from irclib import ip_quad_to_numstr class ArtNoDisp(SingleServerIRCBot): def __init__(self, site, channel, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel self.site = site ns = [] for n in site.namespaces(): if type(n) == type(()): ns += n[0] else: ns += [n]
import re, sys, os, string, time, copy import difflib, traceback import StringIO, zipfile, csv import mailbox, mimetypes, datetime, email.utils import logging import ast import shelve, pprint import pagegenerators, basic # Splitting the bot into library parts import wikipedia as pywikibot from pywikibot import i18n from pywikibot.comms import http import externals # check for and install needed 'externals' externals.check_setup('crontab') # externals.check_setup('odf') # externals.check_setup('openpyxl') # import BeautifulSoup import openpyxl.reader.excel import crontab # TODO: think about what config to move to 'subster-config.css' (per wiki) # e.g. 'VerboseMessage', 'data_VerboseMessage', ... bot_config = { # unicode values 'BotName': pywikibot.config.usernames[pywikibot.config.family][pywikibot.config.mylang], 'TemplateName': u'User:DrTrigonBot/Subster', # or 'template' for 'Flagged Revisions' 'data_PropertyId': u'370', # default: Sandbox-String (P370)
Tool to copy a Panoramio set to Commons ''' # # (C) Multichill, 2010 # # Distributed under the terms of the MIT license. # __version__ = '$Id: 33549fde10d029bde72cf4b133a7f2c7c7275ef4 $' import sys, urllib, re, StringIO, hashlib, base64, time import wikipedia as pywikibot import config, query, imagerecat, upload import externals # check for and install needed externals.check_setup('BeautifulSoup.py') # 'externals' import json from Tkinter import * from PIL import Image, ImageTk # see: http://www.pythonware.com/products/pil/ from BeautifulSoup import BeautifulSoup def isAllowedLicense(photoInfo=None): ''' Check if the image contains the right license TODO: Maybe add more licenses ''' allowed = [u'by-sa']
""" __version__ = "$Id: 55d29d9f38fc751e8f84d9b459641cdd02b25d25 $" # Author: Balasyum # http://hu.wikipedia.org/wiki/User:Balasyum import random import thread import threading import time import rciw import censure import wikipedia as pywikibot import externals externals.check_setup("irclib") from ircbot import SingleServerIRCBot from irclib import nm_to_n ver = 1 site = pywikibot.getSite() site.forceLogin() class rcFeeder(SingleServerIRCBot): def __init__(self, channel, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel self.rcbot = rciw.IWRCBot(site) self.tasks = []
import re, sys, os, string, time, copy import difflib, traceback import StringIO, zipfile, csv import mailbox, mimetypes, datetime, email.utils import logging import ast import shelve, pprint import pagegenerators, basic # Splitting the bot into library parts import wikipedia as pywikibot from pywikibot import i18n from pywikibot.comms import http import catlib import externals # check for and install needed externals.check_setup('BeautifulSoup.py') # 'externals' externals.check_setup('crontab') # externals.check_setup('odf') # externals.check_setup('openpyxl') # import BeautifulSoup import openpyxl.reader.excel import crontab # TODO: think about what config to move to 'subster-config.css' (per wiki) # e.g. 'VerboseMessage', 'data_VerboseMessage', ... bot_config = { # unicode values 'BotName': pywikibot.config.usernames[pywikibot.config.family][pywikibot.config.mylang], 'TemplateName': u'User:DrTrigonBot/Subster', # or 'template' for 'Flagged Revisions' 'data_PropertyId': u'370', # default: Sandbox-String (P370)
import mimetypes import datetime import email.utils import ast import shelve import pprint import pagegenerators import basic # Splitting the bot into library parts import wikipedia as pywikibot from pywikibot import i18n from pywikibot.comms import http import catlib import externals # check for and install needed externals.check_setup('crontab') # externals.check_setup('odf') # externals.check_setup('openpyxl') # import BeautifulSoup import openpyxl.reader.excel import crontab # TODO: think about what config to move to 'subster-config.css' (per wiki) # e.g. 'VerboseMessage', 'data_VerboseMessage', ... bot_config = { # unicode values 'BotName': pywikibot.config.usernames[pywikibot.config.family][ pywikibot.config.mylang], 'TemplateName': u'User:DrTrigonBot/Subster', # or 'template' for 'Flagged Revisions'