Revision: 6947
Author: purodha
Date: 2009-06-09 18:40:41 +0000 (Tue, 09 Jun 2009)
Log Message:
-----------
(r6946) Fix several typos.
(r6943) Add forgotten comments, and parameters.
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2009-06-09 18:22:04 UTC (rev 6946)
+++ trunk/pywikipedia/wikipedia.py 2009-06-09 18:40:41 UTC (rev 6947)
@@ -4885,12 +4885,12 @@
globalRights = globalRights.split('","')
self._rights[index] = globalRights
if self._isLoggedIn[index]:
- if 'Global_bot' in globalRights: # This account had global bot flag, no need to check local flags.
+ if 'Global_bot' in globalRights: # This account has the global bot flag, no need to check local flags.
checkLocal = False
else:
- output(u'Your bot account does not have global bot flag, checking local flag.')
+ output(u'Your bot account does not have global the bot flag, checking local flag.')
else:
- if verbose: output(u'Note:this language does not allowed global bot.')
+ if verbose: output(u'Note: this language does not allow global bots.')
if m and checkLocal:
rights = m.group(1)
rights = rights.split('", "')
@@ -5358,7 +5358,7 @@
if not repeat:
break
- def recentchanges(self, number = 100, rcstart = None, rcend = None, rcshow = None, rctype ='edit|new', repeat = False):
+ def recentchanges(self, number = 100, rcstart = None, rcend = None, rcshow = None, rctype ='edit|new', namespace=None, includeredirects=True, repeat = False):
"""
Yield ImagePages from APIs, call: action=query&list=recentchanges&rctype=edit|new&rclimit=500
@@ -5370,6 +5370,9 @@
rcdir - In which direction to enumerate.
One value: newer, older
Default: older
+ rcnamespace - Filter log entries to only this namespace(s)
+ Values (separate with '|'):
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
rcprop - Include additional pieces of information
Values (separate with '|'):
user, comment, flags, timestamp, title, ids, sizes,
Revision: 6945
Author: purodha
Date: 2009-06-08 13:28:24 +0000 (Mon, 08 Jun 2009)
Log Message:
-----------
few 'ksh' messages added, documentation upgraded.
Modified Paths:
--------------
trunk/pywikipedia/fixes.py
Modified: trunk/pywikipedia/fixes.py
===================================================================
--- trunk/pywikipedia/fixes.py 2009-06-07 20:35:08 UTC (rev 6944)
+++ trunk/pywikipedia/fixes.py 2009-06-08 13:28:24 UTC (rev 6945)
@@ -13,6 +13,12 @@
run this in automatic mode.
* case-de - fix upper/lower case errors in German
* grammar-de - fix grammar and typography in German
+ * vonbis - Ersetze Binde-/Gedankenstrich durch "bis" in German
+ * music - Links auf Begriffsklärungen in German
+ * datum - specific date formats in German
+ * correct-ar - Corrections for Arabic Wikipedia and any Arabic wiki.
+ * yu-tld - the yu top-level domain will soon be disabled, see
+ http://lists.wikimedia.org/pipermail/wikibots-l/2009-February/000290.html
"""
fixes = {
@@ -29,6 +35,7 @@
'fr':u'Robot: convertit/fixe HTML',
'he':u'בוט: ממיר/מתקן HTML',
'ja':u'ロボットによる: HTML転換',
+ 'ksh':u'Bot: vun HTML en Wikikood wandelle',
'ia':u'Robot: conversion/reparation de HTML',
'lt':u'robotas: konvertuojamas/taisomas HTML',
'nl':u'Bot: conversie/reparatie HTML',
@@ -565,6 +572,7 @@
'de': u'Bot: Ersetze Links auf .yu-Domains',
'en': u'Robot: Replacing links to .yu domains',
'fr': u'Robot: Correction des liens pointant vers le domaine .yu, qui expire en 2009',
+ 'ksh': u'Bot: de ahle .yu-Domains loufe us, dröm ußjetuusch',
},
'replacements': [
(u'www.budva.cg.yu', u'www.budva.rs'),
Revision: 6942
Author: purodha
Date: 2009-06-07 05:24:19 +0000 (Sun, 07 Jun 2009)
Log Message:
-----------
Initial version of a recentchenges page generator (via API)
Modified Paths:
--------------
trunk/pywikipedia/pagegenerators.py
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/pagegenerators.py
===================================================================
--- trunk/pywikipedia/pagegenerators.py 2009-06-07 04:40:46 UTC (rev 6941)
+++ trunk/pywikipedia/pagegenerators.py 2009-06-07 05:24:19 UTC (rev 6942)
@@ -133,6 +133,10 @@
-gorandom Specifies that the robot should starting at the random pages
returned by [[Special:Random]].
+
+-recentchanges Work on new and edited pages returned by [[Special:Recentchanges]].
+ Can also be given as "-recentchanges:n" where n is the number
+ of pages to be returned, else 100 pages are returned.
"""
@@ -403,6 +407,12 @@
site = wikipedia.getSite()
for i in range(number):
yield site.randomredirectpage()
+
+def RecentchangesPageGenerator(number = 100, site = None):
+ if site is None:
+ site = wikipedia.getSite()
+ for page in site.recentchanges(number=number):
+ yield page[0]
def TextfilePageGenerator(filename=None, site=None):
'''
@@ -954,6 +964,11 @@
gen = RandomPageGenerator()
else:
gen = RandomPageGenerator(number = int(arg[8:]))
+ elif arg.startswith('-recentchanges'):
+ if len(arg) == 14:
+ gen = RecentchangesPageGenerator()
+ else:
+ gen = RecentchangesPageGenerator(number = int(arg[15:]))
elif arg.startswith('-file'):
textfilename = arg[6:]
if not textfilename:
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2009-06-07 04:40:46 UTC (rev 6941)
+++ trunk/pywikipedia/wikipedia.py 2009-06-07 05:24:19 UTC (rev 6942)
@@ -4274,6 +4274,7 @@
deadendpages(): Special:Deadendpages
ancientpages(): Special:Ancientpages
lonelypages(): Special:Lonelypages
+ recentchanges(): Special:Recentchanges
unwatchedpages(): Special:Unwatchedpages (sysop accounts only)
uncategorizedcategories(): Special:Uncategorizedcategories (yields
Category objects)
@@ -5342,6 +5343,76 @@
if not repeat:
break
+ def recentchanges(self, number = 100, rcstart = None, rcend = None, rcshow = None, rctype ='edit|new', repeat = False):
+ """
+ Yield ImagePages from APIs, call: action=query&list=recentchanges&rctype=edit|new&rclimit=500
+
+ Options directly from APIs:
+ ---
+ Parameters:
+ rcstart - The timestamp to start enumerating from.
+ rcend - The timestamp to end enumerating.
+ rcdir - In which direction to enumerate.
+ One value: newer, older
+ Default: older
+ rcprop - Include additional pieces of information
+ Values (separate with '|'):
+ user, comment, flags, timestamp, title, ids, sizes,
+ redirect, patrolled, loginfo
+ Default: title|timestamp|ids
+ rctoken - Which tokens to obtain for each change
+ Values (separate with '|'): patrol
+ rcshow - Show only items that meet this criteria.
+ For example, to see only minor edits done by
+ logged-in users, set show=minor|!anon
+ Values (separate with '|'):
+ minor, !minor, bot, !bot, anon, !anon,
+ redirect, !redirect, patrolled, !patrolled
+ rclimit - How many total changes to return.
+ No more than 500 (5000 for bots) allowed.
+ Default: 10
+ rctype - Which types of changes to show.
+ Values (separate with '|'): edit, new, log
+ """
+ if rctype is None:
+ rctype = 'edit|new'
+ params = {
+ 'action' : 'query',
+ 'list' : 'recentchanges',
+ 'rctype' : rctype,
+ 'rcprop' : 'user|comment|timestamp|title|ids|loginfo', #|flags|sizes|redirect|patrolled'
+ 'rclimit' : int(number),
+ }
+ if rcstart is not None: params['rcstart'] = rcstart
+ if rcend is not None: params['rcend'] = rcend
+ if rcshow is not None: params['rcshow'] = rcshow
+ if rctype is not None: params['rctype'] = rctype
+ while True:
+ data = query.GetData(params,
+ useAPI = True, encodeTitle = False)
+ try:
+ rcData = data['query']['recentchanges']
+ except KeyError:
+ raise ServerError("The APIs don't return data, the site may be down")
+
+ for rcItem in rcData:
+ try:
+ comment = rcItem['comment']
+ except KeyError:
+ comment = ''
+ try:
+ loginfo = rcItem['loginfo']
+ except KeyError:
+ loginfo = ''
+ # pageid = rcItem['pageid']
+ title = rcItem['title']
+ timestamp = rcItem['timestamp']
+ # logid = rcItem['logid']
+ user = rcItem['user']
+ yield Page(self, title), timestamp, user, comment, loginfo
+ if not repeat:
+ break
+
def uncategorizedimages(self, number = 10, repeat = False):
"""Yield ImagePages from Special:Uncategorizedimages."""
seen = set()
Revision: 6939
Author: purodha
Date: 2009-06-07 02:09:14 +0000 (Sun, 07 Jun 2009)
Log Message:
-----------
typing error in api parameters for Site.newimage() corrected.
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2009-06-07 00:07:23 UTC (rev 6938)
+++ trunk/pywikipedia/wikipedia.py 2009-06-07 02:09:14 UTC (rev 6939)
@@ -5318,8 +5318,8 @@
}
if lestart is not None: params['lestart'] = lestart
if leend is not None: params['leend'] = leend
- if leend is not None: params['leuser'] = leuser
- if leend is not None: params['letitle'] = letitle
+ if leuser is not None: params['leuser'] = leuser
+ if letitle is not None: params['letitle'] = letitle
while True:
data = query.GetData(params,
useAPI = True, encodeTitle = False)
Revision: 6938
Author: purodha
Date: 2009-06-07 00:07:23 +0000 (Sun, 07 Jun 2009)
Log Message:
-----------
parameter description enhanced and more precise.
'ksh' language messages updated.
Modified Paths:
--------------
trunk/pywikipedia/pagefromfile.py
Modified: trunk/pywikipedia/pagefromfile.py
===================================================================
--- trunk/pywikipedia/pagefromfile.py 2009-06-04 20:13:15 UTC (rev 6937)
+++ trunk/pywikipedia/pagefromfile.py 2009-06-07 00:07:23 UTC (rev 6938)
@@ -23,7 +23,13 @@
beginning of page title
-titleend:xxx Use xxx in place of ''' for identifying the
end of page title
--summary:xxx Use xxx as the summary for the upload
+-notitle do not include the title, including titlestart, and
+ titleend, in the page
+-summary:xxx Use xxx as the edit summary for the upload - if
+ a page exists, standard messages are appended
+ after xxx for appending, prepending, or replacement
+-autosummary Use MediaWikis autosummary when creating a new page,
+ overrides -summary in this case
-minor set minor edit flag on page edits
-debug Do not really upload pages, just check and report
messages
@@ -33,7 +39,6 @@
-appendtop add the text to the top of it
-appendbottom add the text to the bottom of it
-force overwrite the existing page
--notitle do not include the title line in the page
"""
#
# (C) Andre Engels, 2004
@@ -67,7 +72,7 @@
'id': u'Impor artikel automatis',
'it': u'Caricamento automatico',
'ja': u'ロボットによる: 記事の作成',
- 'ksh': u'Automatesch aanjelaat',
+ 'ksh': u'Bot: automatesch huhjelaade',
'nl': u'Geautomatiseerde import',
'no': u'bot: Automatisk import',
'pl': u'Automatyczny import artykułów',
@@ -85,7 +90,7 @@
'id': u'ditambahkan di atas',
'it': u'aggiungo in cima',
'ja': u'ロボットによる: 冒頭への追加',
- 'ksh': u'Automatesch füürjesaz',
+ 'ksh': u'un dofüürjesaz',
'nl': u'bovenaan toegevoegd',
'no': u'legger til øverst',
'pl': u'dodaj na górze',
@@ -102,7 +107,7 @@
'id': u'ditambahkan di bawah',
'it': u'aggiungo in fondo',
'ja': u'ロボットによる: 末尾への追加',
- 'ksh': u'Automatesch aanjehange',
+ 'ksh': u'un aanjehange',
'nl': u'onderaan toegevoegd',
'no': u'legger til nederst',
'pl': u'dodaj na dole',
@@ -119,7 +124,7 @@
'id': u'menimpa teks yang ada',
'it': u'sovrascritto il testo esistente',
'ja': u'ロボットによる: ページの置換',
- 'ksh': u'Automatesch ußjetuusch',
+ 'ksh': u'un komplët ußjetuusch',
'nl': u'bestaande tekst overschreven',
'no': u'erstatter eksisterende tekst',
'pl': u'aktualny tekst nadpisany',