rbmediawiki 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Manifest.txt +7 -1
- data/lib/rbmediawiki.rb +6 -7
- data/lib/rbmediawiki/api.rb +917 -0
- data/lib/rbmediawiki/category.rb +37 -0
- data/lib/rbmediawiki/config.yml +4 -0
- data/lib/rbmediawiki/misc_generator.rb +51 -0
- data/lib/rbmediawiki/page.rb +465 -0
- data/lib/rbmediawiki/page_generator.rb +149 -0
- data/lib/rbmediawiki/user.rb +111 -0
- metadata +11 -5
- data/bin/rbmediawiki +0 -3
data/Manifest.txt
CHANGED
@@ -2,6 +2,12 @@ History.txt
|
|
2
2
|
Manifest.txt
|
3
3
|
README.txt
|
4
4
|
Rakefile
|
5
|
-
bin/rbmediawiki
|
6
5
|
lib/rbmediawiki.rb
|
6
|
+
lib/rbmediawiki/api.rb
|
7
|
+
lib/rbmediawiki/category.rb
|
8
|
+
lib/rbmediawiki/config.yml
|
9
|
+
lib/rbmediawiki/misc_generator.rb
|
10
|
+
lib/rbmediawiki/page.rb
|
11
|
+
lib/rbmediawiki/page_generator.rb
|
12
|
+
lib/rbmediawiki/user.rb
|
7
13
|
test/test_rbmediawiki.rb
|
data/lib/rbmediawiki.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require 'page_generator'
|
6
|
-
require 'misc_generator'
|
1
|
+
require 'yaml'
|
2
|
+
require 'net/http'
|
3
|
+
require 'rubygems'
|
4
|
+
require 'xmlsimple'
|
7
5
|
|
8
6
|
class Rbmediawiki
|
9
|
-
VERSION = '0.2.
|
7
|
+
VERSION = '0.2.4'
|
8
|
+
Dir["#{File.dirname(__FILE__)}/rbmediawiki/*.rb"].sort.each { |lib| require lib }
|
10
9
|
end
|
11
10
|
|
@@ -0,0 +1,917 @@
|
|
1
|
+
#coding: utf-8
|
2
|
+
|
3
|
+
Ourconfig = YAML::load(File.open(File.dirname(__FILE__)+"/config.yml"))
|
4
|
+
|
5
|
+
# This class provides an interface for the MediaWiki API.
|
6
|
+
# Methods match specific queries to the API, and so the meaning of the
|
7
|
+
# parameters are described in http://www.mediawiki.org/wiki/API
|
8
|
+
#
|
9
|
+
# It is intended to be used as a base layer to build specific methods on top
|
10
|
+
# of it
|
11
|
+
#
|
12
|
+
# Only four methods are special and deserve comments here: #new, #login, #query and #add_post
|
13
|
+
class Api
|
14
|
+
|
15
|
+
# * lang: language of the wiki at wikimedia.
|
16
|
+
# * family: family of the wiki at wikimedia. If the wiki is not language dependant, as commons.wikimedia.org , lang value is ignored.
|
17
|
+
# * user: user to make the edits
|
18
|
+
# * server: the url of the server, as in http://en.wikipedia.org this parameter overrides lang and family values
|
19
|
+
# * api_url: the url of the api, as in http://en.wikipedia.org if not specified, it will be guessed from the lang+family values or the server
|
20
|
+
def initialize(lang = nil, family = nil, user = nil, server = nil, api_url = nil)
|
21
|
+
@config = Hash.new
|
22
|
+
@config['base_url'] = server
|
23
|
+
@config['api_url'] = api_url
|
24
|
+
@config['logged'] = false
|
25
|
+
@config['user'] = user ? user : Ourconfig['default_user']
|
26
|
+
end
|
27
|
+
|
28
|
+
def api_url
|
29
|
+
return @config['api_url']
|
30
|
+
end
|
31
|
+
|
32
|
+
def base_url
|
33
|
+
return @config['base_url']
|
34
|
+
end
|
35
|
+
|
36
|
+
#Asks for a password and tries to log in. Stores the resulting cookies
|
37
|
+
#for using then when making requests. If the user is already logged iy
|
38
|
+
#does nothing
|
39
|
+
|
40
|
+
def login(password = nil)
|
41
|
+
if @config['logged']
|
42
|
+
return true
|
43
|
+
end
|
44
|
+
if (!password)
|
45
|
+
puts "Introduce password for #{@config['user']} at #{@config['base_url']}"
|
46
|
+
password = gets.chomp
|
47
|
+
end
|
48
|
+
|
49
|
+
post_me = add_post('lgname',@config['user'])
|
50
|
+
post_me = add_post('lgpassword',password, post_me)
|
51
|
+
post_me = add_post('action', 'login', post_me)
|
52
|
+
|
53
|
+
login_result = make_request(post_me)
|
54
|
+
|
55
|
+
@config['lgusername'] = login_result['login']['lgusername']
|
56
|
+
@config['lguserid'] = login_result['login']['lguserid']
|
57
|
+
@config['lgtoken'] = login_result['login']['lgtoken']
|
58
|
+
@config['_session'] = login_result['login']['sessionid']
|
59
|
+
@config['cookieprefix']= login_result['login']['cookieprefix']
|
60
|
+
|
61
|
+
@config['logged'] = true
|
62
|
+
|
63
|
+
return @cookie
|
64
|
+
end
|
65
|
+
|
66
|
+
def query_prop_categories(titles = nil, clprop = nil, clshow = nil, cllimit = nil, clcontinue = nil, clcategories = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
67
|
+
|
68
|
+
post_me = add_post('clprop', clprop, post_me)
|
69
|
+
post_me = add_post('clshow', clshow, post_me)
|
70
|
+
post_me = add_post('cllimit', cllimit, post_me)
|
71
|
+
post_me = add_post('clcontinue', clcontinue, post_me)
|
72
|
+
post_me = add_post('clcategories', clcategories, post_me)
|
73
|
+
post_me = add_post('prop', 'categories', post_me)
|
74
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
75
|
+
post_me = format(post_me, 'xml')
|
76
|
+
result = make_request(post_me)
|
77
|
+
return result
|
78
|
+
end
|
79
|
+
|
80
|
+
def query_prop_images(titles = nil, imlimit = nil, imcontinue = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
81
|
+
|
82
|
+
post_me = add_post('imlimit', imlimit, post_me)
|
83
|
+
post_me = add_post('imcontinue', imcontinue, post_me)
|
84
|
+
post_me = add_post('prop', 'images', post_me)
|
85
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
86
|
+
post_me = format(post_me, 'xml')
|
87
|
+
result = make_request(post_me)
|
88
|
+
return result
|
89
|
+
end
|
90
|
+
|
91
|
+
def query_prop_revisions(titles = nil, rvprop = nil, rvlimit = nil, rvstartid = nil, rvendid = nil, rvstart = nil, rvend = nil, rvdir = nil, rvuser = nil, rvexcludeuser = nil, rvexpandtemplates = nil, rvgeneratexml = nil, rvsection = nil, rvtoken = nil, rvcontinue = nil, rvdiffto = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
92
|
+
|
93
|
+
post_me = add_post('rvprop', rvprop, post_me)
|
94
|
+
post_me = add_post('rvlimit', rvlimit, post_me)
|
95
|
+
post_me = add_post('rvstartid', rvstartid, post_me)
|
96
|
+
post_me = add_post('rvendid', rvendid, post_me)
|
97
|
+
post_me = add_post('rvstart', rvstart, post_me)
|
98
|
+
post_me = add_post('rvend', rvend, post_me)
|
99
|
+
post_me = add_post('rvdir', rvdir, post_me)
|
100
|
+
post_me = add_post('rvuser', rvuser, post_me)
|
101
|
+
post_me = add_post('rvexcludeuser', rvexcludeuser, post_me)
|
102
|
+
post_me = add_post('rvexpandtemplates', rvexpandtemplates, post_me)
|
103
|
+
post_me = add_post('rvgeneratexml', rvgeneratexml, post_me)
|
104
|
+
post_me = add_post('rvsection', rvsection, post_me)
|
105
|
+
post_me = add_post('rvtoken', rvtoken, post_me)
|
106
|
+
post_me = add_post('rvcontinue', rvcontinue, post_me)
|
107
|
+
post_me = add_post('rvdiffto', rvdiffto, post_me)
|
108
|
+
post_me = add_post('prop', 'revisions', post_me)
|
109
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
110
|
+
post_me = format(post_me, 'xml')
|
111
|
+
result = make_request(post_me)
|
112
|
+
return result
|
113
|
+
end
|
114
|
+
|
115
|
+
def query_meta_siteinfo(titles = nil, siprop = nil, sifilteriw = nil, sishowalldb = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
116
|
+
|
117
|
+
post_me = add_post('siprop', siprop, post_me)
|
118
|
+
post_me = add_post('sifilteriw', sifilteriw, post_me)
|
119
|
+
post_me = add_post('sishowalldb', sishowalldb, post_me)
|
120
|
+
post_me = add_post('meta', 'siteinfo', post_me)
|
121
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
122
|
+
post_me = format(post_me, 'xml')
|
123
|
+
result = make_request(post_me)
|
124
|
+
return result
|
125
|
+
end
|
126
|
+
|
127
|
+
def query_list_exturlusage(titles = nil, euprop = nil, euoffset = nil, euprotocol = nil, euquery = nil, eunamespace = nil, eulimit = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
128
|
+
|
129
|
+
post_me = add_post('euprop', euprop, post_me)
|
130
|
+
post_me = add_post('euoffset', euoffset, post_me)
|
131
|
+
post_me = add_post('euprotocol', euprotocol, post_me)
|
132
|
+
post_me = add_post('euquery', euquery, post_me)
|
133
|
+
post_me = add_post('eunamespace', eunamespace, post_me)
|
134
|
+
post_me = add_post('eulimit', eulimit, post_me)
|
135
|
+
post_me = add_post('list', 'exturlusage', post_me)
|
136
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
137
|
+
post_me = format(post_me, 'xml')
|
138
|
+
result = make_request(post_me)
|
139
|
+
return result
|
140
|
+
end
|
141
|
+
|
142
|
+
def query_list_allpages(titles = nil, apfrom = nil, apprefix = nil, apnamespace = nil, apfilterredir = nil, apminsize = nil, apmaxsize = nil, apprtype = nil, apprlevel = nil, apprfiltercascade = nil, aplimit = nil, apdir = nil, apfilterlanglinks = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
143
|
+
|
144
|
+
post_me = add_post('apfrom', apfrom, post_me)
|
145
|
+
post_me = add_post('apprefix', apprefix, post_me)
|
146
|
+
post_me = add_post('apnamespace', apnamespace, post_me)
|
147
|
+
post_me = add_post('apfilterredir', apfilterredir, post_me)
|
148
|
+
post_me = add_post('apminsize', apminsize, post_me)
|
149
|
+
post_me = add_post('apmaxsize', apmaxsize, post_me)
|
150
|
+
post_me = add_post('apprtype', apprtype, post_me)
|
151
|
+
post_me = add_post('apprlevel', apprlevel, post_me)
|
152
|
+
post_me = add_post('apprfiltercascade', apprfiltercascade, post_me)
|
153
|
+
post_me = add_post('aplimit', aplimit, post_me)
|
154
|
+
post_me = add_post('apdir', apdir, post_me)
|
155
|
+
post_me = add_post('apfilterlanglinks', apfilterlanglinks, post_me)
|
156
|
+
post_me = add_post('list', 'allpages', post_me)
|
157
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
158
|
+
post_me = format(post_me, 'xml')
|
159
|
+
result = make_request(post_me)
|
160
|
+
return result
|
161
|
+
end
|
162
|
+
|
163
|
+
def query_meta_allmessages(titles = nil, ammessages = nil, amfilter = nil, amlang = nil, amfrom = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
164
|
+
|
165
|
+
post_me = add_post('ammessages', ammessages, post_me)
|
166
|
+
post_me = add_post('amfilter', amfilter, post_me)
|
167
|
+
post_me = add_post('amlang', amlang, post_me)
|
168
|
+
post_me = add_post('amfrom', amfrom, post_me)
|
169
|
+
post_me = add_post('meta', 'allmessages', post_me)
|
170
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
171
|
+
post_me = format(post_me, 'xml')
|
172
|
+
result = make_request(post_me)
|
173
|
+
return result
|
174
|
+
end
|
175
|
+
|
176
|
+
def query_list_protectedtitles(titles = nil, ptnamespace = nil, ptlevel = nil, ptlimit = nil, ptdir = nil, ptstart = nil, ptend = nil, ptprop = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
177
|
+
|
178
|
+
post_me = add_post('ptnamespace', ptnamespace, post_me)
|
179
|
+
post_me = add_post('ptlevel', ptlevel, post_me)
|
180
|
+
post_me = add_post('ptlimit', ptlimit, post_me)
|
181
|
+
post_me = add_post('ptdir', ptdir, post_me)
|
182
|
+
post_me = add_post('ptstart', ptstart, post_me)
|
183
|
+
post_me = add_post('ptend', ptend, post_me)
|
184
|
+
post_me = add_post('ptprop', ptprop, post_me)
|
185
|
+
post_me = add_post('list', 'protectedtitles', post_me)
|
186
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
187
|
+
post_me = format(post_me, 'xml')
|
188
|
+
result = make_request(post_me)
|
189
|
+
return result
|
190
|
+
end
|
191
|
+
|
192
|
+
def query_list_deletedrevs(titles = nil, drstart = nil, drend = nil, drdir = nil, drfrom = nil, drcontinue = nil, drunique = nil, druser = nil, drexcludeuser = nil, drnamespace = nil, drlimit = nil, drprop = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
193
|
+
|
194
|
+
post_me = add_post('drstart', drstart, post_me)
|
195
|
+
post_me = add_post('drend', drend, post_me)
|
196
|
+
post_me = add_post('drdir', drdir, post_me)
|
197
|
+
post_me = add_post('drfrom', drfrom, post_me)
|
198
|
+
post_me = add_post('drcontinue', drcontinue, post_me)
|
199
|
+
post_me = add_post('drunique', drunique, post_me)
|
200
|
+
post_me = add_post('druser', druser, post_me)
|
201
|
+
post_me = add_post('drexcludeuser', drexcludeuser, post_me)
|
202
|
+
post_me = add_post('drnamespace', drnamespace, post_me)
|
203
|
+
post_me = add_post('drlimit', drlimit, post_me)
|
204
|
+
post_me = add_post('drprop', drprop, post_me)
|
205
|
+
post_me = add_post('list', 'deletedrevs', post_me)
|
206
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
207
|
+
post_me = format(post_me, 'xml')
|
208
|
+
result = make_request(post_me)
|
209
|
+
return result
|
210
|
+
end
|
211
|
+
|
212
|
+
def query_prop_imageinfo(titles = nil, iiprop = nil, iilimit = nil, iistart = nil, iiend = nil, iiurlwidth = nil, iiurlheight = nil, iicontinue = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
213
|
+
|
214
|
+
post_me = add_post('iiprop', iiprop, post_me)
|
215
|
+
post_me = add_post('iilimit', iilimit, post_me)
|
216
|
+
post_me = add_post('iistart', iistart, post_me)
|
217
|
+
post_me = add_post('iiend', iiend, post_me)
|
218
|
+
post_me = add_post('iiurlwidth', iiurlwidth, post_me)
|
219
|
+
post_me = add_post('iiurlheight', iiurlheight, post_me)
|
220
|
+
post_me = add_post('iicontinue', iicontinue, post_me)
|
221
|
+
post_me = add_post('prop', 'imageinfo', post_me)
|
222
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
223
|
+
post_me = format(post_me, 'xml')
|
224
|
+
result = make_request(post_me)
|
225
|
+
return result
|
226
|
+
end
|
227
|
+
|
228
|
+
def query_list_blocks(titles = nil, bkstart = nil, bkend = nil, bkdir = nil, bkids = nil, bkusers = nil, bkip = nil, bklimit = nil, bkprop = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
229
|
+
|
230
|
+
post_me = add_post('bkstart', bkstart, post_me)
|
231
|
+
post_me = add_post('bkend', bkend, post_me)
|
232
|
+
post_me = add_post('bkdir', bkdir, post_me)
|
233
|
+
post_me = add_post('bkids', bkids, post_me)
|
234
|
+
post_me = add_post('bkusers', bkusers, post_me)
|
235
|
+
post_me = add_post('bkip', bkip, post_me)
|
236
|
+
post_me = add_post('bklimit', bklimit, post_me)
|
237
|
+
post_me = add_post('bkprop', bkprop, post_me)
|
238
|
+
post_me = add_post('list', 'blocks', post_me)
|
239
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
240
|
+
post_me = format(post_me, 'xml')
|
241
|
+
result = make_request(post_me)
|
242
|
+
return result
|
243
|
+
end
|
244
|
+
|
245
|
+
def query_list_alllinks(titles = nil, alcontinue = nil, alfrom = nil, alprefix = nil, alunique = nil, alprop = nil, alnamespace = nil, allimit = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
246
|
+
|
247
|
+
post_me = add_post('alcontinue', alcontinue, post_me)
|
248
|
+
post_me = add_post('alfrom', alfrom, post_me)
|
249
|
+
post_me = add_post('alprefix', alprefix, post_me)
|
250
|
+
post_me = add_post('alunique', alunique, post_me)
|
251
|
+
post_me = add_post('alprop', alprop, post_me)
|
252
|
+
post_me = add_post('alnamespace', alnamespace, post_me)
|
253
|
+
post_me = add_post('allimit', allimit, post_me)
|
254
|
+
post_me = add_post('list', 'alllinks', post_me)
|
255
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
256
|
+
post_me = format(post_me, 'xml')
|
257
|
+
result = make_request(post_me)
|
258
|
+
return result
|
259
|
+
end
|
260
|
+
|
261
|
+
def query_meta_userinfo(titles = nil, uiprop = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
262
|
+
|
263
|
+
post_me = add_post('uiprop', uiprop, post_me)
|
264
|
+
post_me = add_post('meta', 'userinfo', post_me)
|
265
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
266
|
+
post_me = format(post_me, 'xml')
|
267
|
+
result = make_request(post_me)
|
268
|
+
return result
|
269
|
+
end
|
270
|
+
|
271
|
+
def query_list_random(titles = nil, rnnamespace = nil, rnlimit = nil, rnredirect = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
272
|
+
|
273
|
+
post_me = add_post('rnnamespace', rnnamespace, post_me)
|
274
|
+
post_me = add_post('rnlimit', rnlimit, post_me)
|
275
|
+
post_me = add_post('rnredirect', rnredirect, post_me)
|
276
|
+
post_me = add_post('list', 'random', post_me)
|
277
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
278
|
+
post_me = format(post_me, 'xml')
|
279
|
+
result = make_request(post_me)
|
280
|
+
return result
|
281
|
+
end
|
282
|
+
|
283
|
+
def query_list_categorymembers(titles = nil, cmtitle = nil, cmprop = nil, cmnamespace = nil, cmcontinue = nil, cmlimit = nil, cmsort = nil, cmdir = nil, cmstart = nil, cmend = nil, cmstartsortkey = nil, cmendsortkey = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
284
|
+
|
285
|
+
post_me = add_post('cmtitle', cmtitle, post_me)
|
286
|
+
post_me = add_post('cmprop', cmprop, post_me)
|
287
|
+
post_me = add_post('cmnamespace', cmnamespace, post_me)
|
288
|
+
post_me = add_post('cmcontinue', cmcontinue, post_me)
|
289
|
+
post_me = add_post('cmlimit', cmlimit, post_me)
|
290
|
+
post_me = add_post('cmsort', cmsort, post_me)
|
291
|
+
post_me = add_post('cmdir', cmdir, post_me)
|
292
|
+
post_me = add_post('cmstart', cmstart, post_me)
|
293
|
+
post_me = add_post('cmend', cmend, post_me)
|
294
|
+
post_me = add_post('cmstartsortkey', cmstartsortkey, post_me)
|
295
|
+
post_me = add_post('cmendsortkey', cmendsortkey, post_me)
|
296
|
+
post_me = add_post('list', 'categorymembers', post_me)
|
297
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
298
|
+
post_me = format(post_me, 'xml')
|
299
|
+
result = make_request(post_me)
|
300
|
+
return result
|
301
|
+
end
|
302
|
+
|
303
|
+
def query_list_allusers(titles = nil, aufrom = nil, auprefix = nil, augroup = nil, auprop = nil, aulimit = nil, auwitheditsonly = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
304
|
+
|
305
|
+
post_me = add_post('aufrom', aufrom, post_me)
|
306
|
+
post_me = add_post('auprefix', auprefix, post_me)
|
307
|
+
post_me = add_post('augroup', augroup, post_me)
|
308
|
+
post_me = add_post('auprop', auprop, post_me)
|
309
|
+
post_me = add_post('aulimit', aulimit, post_me)
|
310
|
+
post_me = add_post('auwitheditsonly', auwitheditsonly, post_me)
|
311
|
+
post_me = add_post('list', 'allusers', post_me)
|
312
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
313
|
+
post_me = format(post_me, 'xml')
|
314
|
+
result = make_request(post_me)
|
315
|
+
return result
|
316
|
+
end
|
317
|
+
|
318
|
+
def query_prop_duplicatefiles(titles = nil, dflimit = nil, dfcontinue = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
319
|
+
|
320
|
+
post_me = add_post('dflimit', dflimit, post_me)
|
321
|
+
post_me = add_post('dfcontinue', dfcontinue, post_me)
|
322
|
+
post_me = add_post('prop', 'duplicatefiles', post_me)
|
323
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
324
|
+
post_me = format(post_me, 'xml')
|
325
|
+
result = make_request(post_me)
|
326
|
+
return result
|
327
|
+
end
|
328
|
+
|
329
|
+
def query_list_watchlist(titles = nil, wlallrev = nil, wlstart = nil, wlend = nil, wlnamespace = nil, wldir = nil, wllimit = nil, wlprop = nil, wlshow = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
330
|
+
|
331
|
+
post_me = add_post('wlallrev', wlallrev, post_me)
|
332
|
+
post_me = add_post('wlstart', wlstart, post_me)
|
333
|
+
post_me = add_post('wlend', wlend, post_me)
|
334
|
+
post_me = add_post('wlnamespace', wlnamespace, post_me)
|
335
|
+
post_me = add_post('wldir', wldir, post_me)
|
336
|
+
post_me = add_post('wllimit', wllimit, post_me)
|
337
|
+
post_me = add_post('wlprop', wlprop, post_me)
|
338
|
+
post_me = add_post('wlshow', wlshow, post_me)
|
339
|
+
post_me = add_post('list', 'watchlist', post_me)
|
340
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
341
|
+
post_me = format(post_me, 'xml')
|
342
|
+
result = make_request(post_me)
|
343
|
+
return result
|
344
|
+
end
|
345
|
+
|
346
|
+
def query_list_search(titles = nil, srsearch = nil, srnamespace = nil, srwhat = nil, srredirects = nil, sroffset = nil, srlimit = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
347
|
+
|
348
|
+
post_me = add_post('srsearch', srsearch, post_me)
|
349
|
+
post_me = add_post('srnamespace', srnamespace, post_me)
|
350
|
+
post_me = add_post('srwhat', srwhat, post_me)
|
351
|
+
post_me = add_post('srredirects', srredirects, post_me)
|
352
|
+
post_me = add_post('sroffset', sroffset, post_me)
|
353
|
+
post_me = add_post('srlimit', srlimit, post_me)
|
354
|
+
post_me = add_post('list', 'search', post_me)
|
355
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
356
|
+
post_me = format(post_me, 'xml')
|
357
|
+
result = make_request(post_me)
|
358
|
+
return result
|
359
|
+
end
|
360
|
+
|
361
|
+
def query_list_embeddedin(titles = nil, eititle = nil, eicontinue = nil, einamespace = nil, eifilterredir = nil, eilimit = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
362
|
+
|
363
|
+
post_me = add_post('eititle', eititle, post_me)
|
364
|
+
post_me = add_post('eicontinue', eicontinue, post_me)
|
365
|
+
post_me = add_post('einamespace', einamespace, post_me)
|
366
|
+
post_me = add_post('eifilterredir', eifilterredir, post_me)
|
367
|
+
post_me = add_post('eilimit', eilimit, post_me)
|
368
|
+
post_me = add_post('list', 'embeddedin', post_me)
|
369
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
370
|
+
post_me = format(post_me, 'xml')
|
371
|
+
result = make_request(post_me)
|
372
|
+
return result
|
373
|
+
end
|
374
|
+
|
375
|
+
def query_prop_extlinks(titles = nil, ellimit = nil, eloffset = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
376
|
+
|
377
|
+
post_me = add_post('ellimit', ellimit, post_me)
|
378
|
+
post_me = add_post('eloffset', eloffset, post_me)
|
379
|
+
post_me = add_post('prop', 'extlinks', post_me)
|
380
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
381
|
+
post_me = format(post_me, 'xml')
|
382
|
+
result = make_request(post_me)
|
383
|
+
return result
|
384
|
+
end
|
385
|
+
|
386
|
+
def query_list_globalblocks(titles = nil, bgstart = nil, bgend = nil, bgdir = nil, bgids = nil, bgaddresses = nil, bgip = nil, bglimit = nil, bgprop = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
387
|
+
|
388
|
+
post_me = add_post('bgstart', bgstart, post_me)
|
389
|
+
post_me = add_post('bgend', bgend, post_me)
|
390
|
+
post_me = add_post('bgdir', bgdir, post_me)
|
391
|
+
post_me = add_post('bgids', bgids, post_me)
|
392
|
+
post_me = add_post('bgaddresses', bgaddresses, post_me)
|
393
|
+
post_me = add_post('bgip', bgip, post_me)
|
394
|
+
post_me = add_post('bglimit', bglimit, post_me)
|
395
|
+
post_me = add_post('bgprop', bgprop, post_me)
|
396
|
+
post_me = add_post('list', 'globalblocks', post_me)
|
397
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
398
|
+
post_me = format(post_me, 'xml')
|
399
|
+
result = make_request(post_me)
|
400
|
+
return result
|
401
|
+
end
|
402
|
+
|
403
|
+
def query_list_watchlistraw(titles = nil, wrcontinue = nil, wrnamespace = nil, wrlimit = nil, wrprop = nil, wrshow = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
404
|
+
|
405
|
+
post_me = add_post('wrcontinue', wrcontinue, post_me)
|
406
|
+
post_me = add_post('wrnamespace', wrnamespace, post_me)
|
407
|
+
post_me = add_post('wrlimit', wrlimit, post_me)
|
408
|
+
post_me = add_post('wrprop', wrprop, post_me)
|
409
|
+
post_me = add_post('wrshow', wrshow, post_me)
|
410
|
+
post_me = add_post('list', 'watchlistraw', post_me)
|
411
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
412
|
+
post_me = format(post_me, 'xml')
|
413
|
+
result = make_request(post_me)
|
414
|
+
return result
|
415
|
+
end
|
416
|
+
|
417
|
+
def query_list_usercontribs(titles = nil, uclimit = nil, ucstart = nil, ucend = nil, uccontinue = nil, ucuser = nil, ucuserprefix = nil, ucdir = nil, ucnamespace = nil, ucprop = nil, ucshow = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
418
|
+
|
419
|
+
post_me = add_post('uclimit', uclimit, post_me)
|
420
|
+
post_me = add_post('ucstart', ucstart, post_me)
|
421
|
+
post_me = add_post('ucend', ucend, post_me)
|
422
|
+
post_me = add_post('uccontinue', uccontinue, post_me)
|
423
|
+
post_me = add_post('ucuser', ucuser, post_me)
|
424
|
+
post_me = add_post('ucuserprefix', ucuserprefix, post_me)
|
425
|
+
post_me = add_post('ucdir', ucdir, post_me)
|
426
|
+
post_me = add_post('ucnamespace', ucnamespace, post_me)
|
427
|
+
post_me = add_post('ucprop', ucprop, post_me)
|
428
|
+
post_me = add_post('ucshow', ucshow, post_me)
|
429
|
+
post_me = add_post('list', 'usercontribs', post_me)
|
430
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
431
|
+
post_me = format(post_me, 'xml')
|
432
|
+
result = make_request(post_me)
|
433
|
+
return result
|
434
|
+
end
|
435
|
+
|
436
|
+
def query_list_logevents(titles = nil, leprop = nil, letype = nil, lestart = nil, leend = nil, ledir = nil, leuser = nil, letitle = nil, lelimit = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
437
|
+
|
438
|
+
post_me = add_post('leprop', leprop, post_me)
|
439
|
+
post_me = add_post('letype', letype, post_me)
|
440
|
+
post_me = add_post('lestart', lestart, post_me)
|
441
|
+
post_me = add_post('leend', leend, post_me)
|
442
|
+
post_me = add_post('ledir', ledir, post_me)
|
443
|
+
post_me = add_post('leuser', leuser, post_me)
|
444
|
+
post_me = add_post('letitle', letitle, post_me)
|
445
|
+
post_me = add_post('lelimit', lelimit, post_me)
|
446
|
+
post_me = add_post('list', 'logevents', post_me)
|
447
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
448
|
+
post_me = format(post_me, 'xml')
|
449
|
+
result = make_request(post_me)
|
450
|
+
return result
|
451
|
+
end
|
452
|
+
|
453
|
+
def query_list_backlinks(titles = nil, bltitle = nil, blcontinue = nil, blnamespace = nil, blfilterredir = nil, bllimit = nil, blredirect = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
454
|
+
|
455
|
+
post_me = add_post('bltitle', bltitle, post_me)
|
456
|
+
post_me = add_post('blcontinue', blcontinue, post_me)
|
457
|
+
post_me = add_post('blnamespace', blnamespace, post_me)
|
458
|
+
post_me = add_post('blfilterredir', blfilterredir, post_me)
|
459
|
+
post_me = add_post('bllimit', bllimit, post_me)
|
460
|
+
post_me = add_post('blredirect', blredirect, post_me)
|
461
|
+
post_me = add_post('list', 'backlinks', post_me)
|
462
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
463
|
+
post_me = format(post_me, 'xml')
|
464
|
+
result = make_request(post_me)
|
465
|
+
return result
|
466
|
+
end
|
467
|
+
|
468
|
+
def query_list_allcategories(titles = nil, acfrom = nil, acprefix = nil, acdir = nil, aclimit = nil, acprop = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
469
|
+
|
470
|
+
post_me = add_post('acfrom', acfrom, post_me)
|
471
|
+
post_me = add_post('acprefix', acprefix, post_me)
|
472
|
+
post_me = add_post('acdir', acdir, post_me)
|
473
|
+
post_me = add_post('aclimit', aclimit, post_me)
|
474
|
+
post_me = add_post('acprop', acprop, post_me)
|
475
|
+
post_me = add_post('list', 'allcategories', post_me)
|
476
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
477
|
+
post_me = format(post_me, 'xml')
|
478
|
+
result = make_request(post_me)
|
479
|
+
return result
|
480
|
+
end
|
481
|
+
|
482
|
+
def query_list_allimages(titles = nil, aifrom = nil, aiprefix = nil, aiminsize = nil, aimaxsize = nil, ailimit = nil, aidir = nil, aisha1 = nil, aisha1base36 = nil, aiprop = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
483
|
+
|
484
|
+
post_me = add_post('aifrom', aifrom, post_me)
|
485
|
+
post_me = add_post('aiprefix', aiprefix, post_me)
|
486
|
+
post_me = add_post('aiminsize', aiminsize, post_me)
|
487
|
+
post_me = add_post('aimaxsize', aimaxsize, post_me)
|
488
|
+
post_me = add_post('ailimit', ailimit, post_me)
|
489
|
+
post_me = add_post('aidir', aidir, post_me)
|
490
|
+
post_me = add_post('aisha1', aisha1, post_me)
|
491
|
+
post_me = add_post('aisha1base36', aisha1base36, post_me)
|
492
|
+
post_me = add_post('aiprop', aiprop, post_me)
|
493
|
+
post_me = add_post('list', 'allimages', post_me)
|
494
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
495
|
+
post_me = format(post_me, 'xml')
|
496
|
+
result = make_request(post_me)
|
497
|
+
return result
|
498
|
+
end
|
499
|
+
|
500
|
+
def query_prop_info(titles = nil, inprop = nil, intoken = nil, incontinue = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
501
|
+
|
502
|
+
post_me = add_post('inprop', inprop, post_me)
|
503
|
+
post_me = add_post('intoken', intoken, post_me)
|
504
|
+
post_me = add_post('incontinue', incontinue, post_me)
|
505
|
+
post_me = add_post('prop', 'info', post_me)
|
506
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
507
|
+
post_me = format(post_me, 'xml')
|
508
|
+
result = make_request(post_me)
|
509
|
+
return result
|
510
|
+
end
|
511
|
+
|
512
|
+
def query_list_users(titles = nil, usprop = nil, ususers = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
513
|
+
|
514
|
+
post_me = add_post('usprop', usprop, post_me)
|
515
|
+
post_me = add_post('ususers', ususers, post_me)
|
516
|
+
post_me = add_post('list', 'users', post_me)
|
517
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
518
|
+
post_me = format(post_me, 'xml')
|
519
|
+
result = make_request(post_me)
|
520
|
+
return result
|
521
|
+
end
|
522
|
+
|
523
|
+
def query_list_recentchanges(titles = nil, rcstart = nil, rcend = nil, rcdir = nil, rcnamespace = nil, rcprop = nil, rctoken = nil, rcshow = nil, rclimit = nil, rctype = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
524
|
+
|
525
|
+
post_me = add_post('rcstart', rcstart, post_me)
|
526
|
+
post_me = add_post('rcend', rcend, post_me)
|
527
|
+
post_me = add_post('rcdir', rcdir, post_me)
|
528
|
+
post_me = add_post('rcnamespace', rcnamespace, post_me)
|
529
|
+
post_me = add_post('rcprop', rcprop, post_me)
|
530
|
+
post_me = add_post('rctoken', rctoken, post_me)
|
531
|
+
post_me = add_post('rcshow', rcshow, post_me)
|
532
|
+
post_me = add_post('rclimit', rclimit, post_me)
|
533
|
+
post_me = add_post('rctype', rctype, post_me)
|
534
|
+
post_me = add_post('list', 'recentchanges', post_me)
|
535
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
536
|
+
post_me = format(post_me, 'xml')
|
537
|
+
result = make_request(post_me)
|
538
|
+
return result
|
539
|
+
end
|
540
|
+
|
541
|
+
def query_list_imageusage(titles = nil, iutitle = nil, iucontinue = nil, iunamespace = nil, iufilterredir = nil, iulimit = nil, iuredirect = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
542
|
+
|
543
|
+
post_me = add_post('iutitle', iutitle, post_me)
|
544
|
+
post_me = add_post('iucontinue', iucontinue, post_me)
|
545
|
+
post_me = add_post('iunamespace', iunamespace, post_me)
|
546
|
+
post_me = add_post('iufilterredir', iufilterredir, post_me)
|
547
|
+
post_me = add_post('iulimit', iulimit, post_me)
|
548
|
+
post_me = add_post('iuredirect', iuredirect, post_me)
|
549
|
+
post_me = add_post('list', 'imageusage', post_me)
|
550
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
551
|
+
post_me = format(post_me, 'xml')
|
552
|
+
result = make_request(post_me)
|
553
|
+
return result
|
554
|
+
end
|
555
|
+
|
556
|
+
def query_prop_templates(titles = nil, tlnamespace = nil, tllimit = nil, tlcontinue = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
557
|
+
|
558
|
+
post_me = add_post('tlnamespace', tlnamespace, post_me)
|
559
|
+
post_me = add_post('tllimit', tllimit, post_me)
|
560
|
+
post_me = add_post('tlcontinue', tlcontinue, post_me)
|
561
|
+
post_me = add_post('prop', 'templates', post_me)
|
562
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
563
|
+
post_me = format(post_me, 'xml')
|
564
|
+
result = make_request(post_me)
|
565
|
+
return result
|
566
|
+
end
|
567
|
+
|
568
|
+
def query_prop_links(titles = nil, plnamespace = nil, pllimit = nil, plcontinue = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
569
|
+
|
570
|
+
post_me = add_post('plnamespace', plnamespace, post_me)
|
571
|
+
post_me = add_post('pllimit', pllimit, post_me)
|
572
|
+
post_me = add_post('plcontinue', plcontinue, post_me)
|
573
|
+
post_me = add_post('prop', 'links', post_me)
|
574
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
575
|
+
post_me = format(post_me, 'xml')
|
576
|
+
result = make_request(post_me)
|
577
|
+
return result
|
578
|
+
end
|
579
|
+
|
580
|
+
def query_prop_categoryinfo(titles = nil, cicontinue = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
581
|
+
|
582
|
+
post_me = add_post('cicontinue', cicontinue, post_me)
|
583
|
+
post_me = add_post('prop', 'categoryinfo', post_me)
|
584
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
585
|
+
post_me = format(post_me, 'xml')
|
586
|
+
result = make_request(post_me)
|
587
|
+
return result
|
588
|
+
end
|
589
|
+
|
590
|
+
def query_prop_langlinks(titles = nil, lllimit = nil, llcontinue = nil, pageids = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil, post_me = nil)
|
591
|
+
|
592
|
+
post_me = add_post('lllimit', lllimit, post_me)
|
593
|
+
post_me = add_post('llcontinue', llcontinue, post_me)
|
594
|
+
post_me = add_post('prop', 'langlinks', post_me)
|
595
|
+
post_me = query(post_me, titles, pageids, revids, redirects, indexpageids, export, exportnowrap)
|
596
|
+
post_me = format(post_me, 'xml')
|
597
|
+
result = make_request(post_me)
|
598
|
+
return result
|
599
|
+
end
|
600
|
+
def delete(title = nil, pageid = nil, token = nil, reason = nil, watch = nil, unwatch = nil, oldimage = nil, post_me = nil)
|
601
|
+
|
602
|
+
post_me = add_post('title', title, post_me)
|
603
|
+
post_me = add_post('pageid', pageid, post_me)
|
604
|
+
post_me = add_post('token', token, post_me)
|
605
|
+
post_me = add_post('reason', reason, post_me)
|
606
|
+
post_me = add_post('watch', watch, post_me)
|
607
|
+
post_me = add_post('unwatch', unwatch, post_me)
|
608
|
+
post_me = add_post('oldimage', oldimage, post_me)
|
609
|
+
post_me = add_post('action', 'delete', post_me)
|
610
|
+
post_me = format(post_me, 'xml')
|
611
|
+
result = make_request(post_me)
|
612
|
+
return result
|
613
|
+
end
|
614
|
+
|
615
|
+
def purge(titles = nil, post_me = nil)
|
616
|
+
|
617
|
+
post_me = add_post('titles', titles, post_me)
|
618
|
+
post_me = add_post('action', 'purge', post_me)
|
619
|
+
post_me = format(post_me, 'xml')
|
620
|
+
result = make_request(post_me)
|
621
|
+
return result
|
622
|
+
end
|
623
|
+
|
624
|
+
def parse(title = nil, text = nil, page = nil, redirects = nil, oldid = nil, prop = nil, pst = nil, onlypst = nil, post_me = nil)
|
625
|
+
|
626
|
+
post_me = add_post('title', title, post_me)
|
627
|
+
post_me = add_post('text', text, post_me)
|
628
|
+
post_me = add_post('page', page, post_me)
|
629
|
+
post_me = add_post('redirects', redirects, post_me)
|
630
|
+
post_me = add_post('oldid', oldid, post_me)
|
631
|
+
post_me = add_post('prop', prop, post_me)
|
632
|
+
post_me = add_post('pst', pst, post_me)
|
633
|
+
post_me = add_post('onlypst', onlypst, post_me)
|
634
|
+
post_me = add_post('action', 'parse', post_me)
|
635
|
+
post_me = format(post_me, 'xml')
|
636
|
+
result = make_request(post_me)
|
637
|
+
return result
|
638
|
+
end
|
639
|
+
|
640
|
+
def expandtemplates(title = nil, text = nil, generatexml = nil, post_me = nil)
|
641
|
+
|
642
|
+
post_me = add_post('title', title, post_me)
|
643
|
+
post_me = add_post('text', text, post_me)
|
644
|
+
post_me = add_post('generatexml', generatexml, post_me)
|
645
|
+
post_me = add_post('action', 'expandtemplates', post_me)
|
646
|
+
post_me = format(post_me, 'xml')
|
647
|
+
result = make_request(post_me)
|
648
|
+
return result
|
649
|
+
end
|
650
|
+
|
651
|
+
def edit(title = nil, section = nil, text = nil, token = nil, summary = nil, minor = nil, notminor = nil, bot = nil, basetimestamp = nil, starttimestamp = nil, recreate = nil, createonly = nil, nocreate = nil, captchaword = nil, captchaid = nil, watch = nil, unwatch = nil, md5 = nil, prependtext = nil, appendtext = nil, undo = nil, undoafter = nil, post_me = nil)
|
652
|
+
|
653
|
+
post_me = add_post('title', title, post_me)
|
654
|
+
post_me = add_post('section', section, post_me)
|
655
|
+
post_me = add_post('text', text, post_me)
|
656
|
+
post_me = add_post('token', token, post_me)
|
657
|
+
post_me = add_post('summary', summary, post_me)
|
658
|
+
post_me = add_post('minor', minor, post_me)
|
659
|
+
post_me = add_post('notminor', notminor, post_me)
|
660
|
+
post_me = add_post('bot', bot, post_me)
|
661
|
+
post_me = add_post('basetimestamp', basetimestamp, post_me)
|
662
|
+
post_me = add_post('starttimestamp', starttimestamp, post_me)
|
663
|
+
post_me = add_post('recreate', recreate, post_me)
|
664
|
+
post_me = add_post('createonly', createonly, post_me)
|
665
|
+
post_me = add_post('nocreate', nocreate, post_me)
|
666
|
+
post_me = add_post('captchaword', captchaword, post_me)
|
667
|
+
post_me = add_post('captchaid', captchaid, post_me)
|
668
|
+
post_me = add_post('watch', watch, post_me)
|
669
|
+
post_me = add_post('unwatch', unwatch, post_me)
|
670
|
+
post_me = add_post('md5', md5, post_me)
|
671
|
+
post_me = add_post('prependtext', prependtext, post_me)
|
672
|
+
post_me = add_post('appendtext', appendtext, post_me)
|
673
|
+
post_me = add_post('undo', undo, post_me)
|
674
|
+
post_me = add_post('undoafter', undoafter, post_me)
|
675
|
+
post_me = add_post('action', 'edit', post_me)
|
676
|
+
post_me = format(post_me, 'xml')
|
677
|
+
result = make_request(post_me)
|
678
|
+
return result
|
679
|
+
end
|
680
|
+
|
681
|
+
def watch(title = nil, unwatch = nil, post_me = nil)
|
682
|
+
|
683
|
+
post_me = add_post('title', title, post_me)
|
684
|
+
post_me = add_post('unwatch', unwatch, post_me)
|
685
|
+
post_me = add_post('action', 'watch', post_me)
|
686
|
+
post_me = format(post_me, 'xml')
|
687
|
+
result = make_request(post_me)
|
688
|
+
return result
|
689
|
+
end
|
690
|
+
|
691
|
+
def protect(title = nil, token = nil, protections = nil, expiry = nil, reason = nil, cascade = nil, watch = nil, post_me = nil)
|
692
|
+
|
693
|
+
post_me = add_post('title', title, post_me)
|
694
|
+
post_me = add_post('token', token, post_me)
|
695
|
+
post_me = add_post('protections', protections, post_me)
|
696
|
+
post_me = add_post('expiry', expiry, post_me)
|
697
|
+
post_me = add_post('reason', reason, post_me)
|
698
|
+
post_me = add_post('cascade', cascade, post_me)
|
699
|
+
post_me = add_post('watch', watch, post_me)
|
700
|
+
post_me = add_post('action', 'protect', post_me)
|
701
|
+
post_me = format(post_me, 'xml')
|
702
|
+
result = make_request(post_me)
|
703
|
+
return result
|
704
|
+
end
|
705
|
+
|
706
|
+
def rollback(title = nil, user = nil, token = nil, summary = nil, markbot = nil, post_me = nil)
|
707
|
+
|
708
|
+
post_me = add_post('title', title, post_me)
|
709
|
+
post_me = add_post('user', user, post_me)
|
710
|
+
post_me = add_post('token', token, post_me)
|
711
|
+
post_me = add_post('summary', summary, post_me)
|
712
|
+
post_me = add_post('markbot', markbot, post_me)
|
713
|
+
post_me = add_post('action', 'rollback', post_me)
|
714
|
+
post_me = format(post_me, 'xml')
|
715
|
+
result = make_request(post_me)
|
716
|
+
return result
|
717
|
+
end
|
718
|
+
|
719
|
+
def feedwatchlist(feedformat = nil, hours = nil, allrev = nil, post_me = nil)
|
720
|
+
|
721
|
+
post_me = add_post('feedformat', feedformat, post_me)
|
722
|
+
post_me = add_post('hours', hours, post_me)
|
723
|
+
post_me = add_post('allrev', allrev, post_me)
|
724
|
+
post_me = add_post('action', 'feedwatchlist', post_me)
|
725
|
+
post_me = format(post_me, 'xml')
|
726
|
+
result = make_request(post_me)
|
727
|
+
return result
|
728
|
+
end
|
729
|
+
|
730
|
+
def patrol(token = nil, rcid = nil, post_me = nil)
|
731
|
+
|
732
|
+
post_me = add_post('token', token, post_me)
|
733
|
+
post_me = add_post('rcid', rcid, post_me)
|
734
|
+
post_me = add_post('action', 'patrol', post_me)
|
735
|
+
post_me = format(post_me, 'xml')
|
736
|
+
result = make_request(post_me)
|
737
|
+
return result
|
738
|
+
end
|
739
|
+
|
740
|
+
def paraminfo(modules = nil, querymodules = nil, mainmodule = nil, pagesetmodule = nil, post_me = nil)
|
741
|
+
|
742
|
+
post_me = add_post('modules', modules, post_me)
|
743
|
+
post_me = add_post('querymodules', querymodules, post_me)
|
744
|
+
post_me = add_post('mainmodule', mainmodule, post_me)
|
745
|
+
post_me = add_post('pagesetmodule', pagesetmodule, post_me)
|
746
|
+
post_me = add_post('action', 'paraminfo', post_me)
|
747
|
+
post_me = format(post_me, 'xml')
|
748
|
+
result = make_request(post_me)
|
749
|
+
return result
|
750
|
+
end
|
751
|
+
|
752
|
+
def move(from = nil, fromid = nil, to = nil, token = nil, reason = nil, movetalk = nil, movesubpages = nil, noredirect = nil, watch = nil, unwatch = nil, post_me = nil)
|
753
|
+
|
754
|
+
post_me = add_post('from', from, post_me)
|
755
|
+
post_me = add_post('fromid', fromid, post_me)
|
756
|
+
post_me = add_post('to', to, post_me)
|
757
|
+
post_me = add_post('token', token, post_me)
|
758
|
+
post_me = add_post('reason', reason, post_me)
|
759
|
+
post_me = add_post('movetalk', movetalk, post_me)
|
760
|
+
post_me = add_post('movesubpages', movesubpages, post_me)
|
761
|
+
post_me = add_post('noredirect', noredirect, post_me)
|
762
|
+
post_me = add_post('watch', watch, post_me)
|
763
|
+
post_me = add_post('unwatch', unwatch, post_me)
|
764
|
+
post_me = add_post('action', 'move', post_me)
|
765
|
+
post_me = format(post_me, 'xml')
|
766
|
+
result = make_request(post_me)
|
767
|
+
return result
|
768
|
+
end
|
769
|
+
|
770
|
+
def block(user = nil, token = nil, gettoken = nil, expiry = nil, reason = nil, anononly = nil, nocreate = nil, autoblock = nil, noemail = nil, hidename = nil, allowusertalk = nil, reblock = nil, post_me = nil)
|
771
|
+
|
772
|
+
post_me = add_post('user', user, post_me)
|
773
|
+
post_me = add_post('token', token, post_me)
|
774
|
+
post_me = add_post('gettoken', gettoken, post_me)
|
775
|
+
post_me = add_post('expiry', expiry, post_me)
|
776
|
+
post_me = add_post('reason', reason, post_me)
|
777
|
+
post_me = add_post('anononly', anononly, post_me)
|
778
|
+
post_me = add_post('nocreate', nocreate, post_me)
|
779
|
+
post_me = add_post('autoblock', autoblock, post_me)
|
780
|
+
post_me = add_post('noemail', noemail, post_me)
|
781
|
+
post_me = add_post('hidename', hidename, post_me)
|
782
|
+
post_me = add_post('allowusertalk', allowusertalk, post_me)
|
783
|
+
post_me = add_post('reblock', reblock, post_me)
|
784
|
+
post_me = add_post('action', 'block', post_me)
|
785
|
+
post_me = format(post_me, 'xml')
|
786
|
+
result = make_request(post_me)
|
787
|
+
return result
|
788
|
+
end
|
789
|
+
|
790
|
+
def emailuser(target = nil, subject = nil, text = nil, token = nil, ccme = nil, post_me = nil)
|
791
|
+
|
792
|
+
post_me = add_post('target', target, post_me)
|
793
|
+
post_me = add_post('subject', subject, post_me)
|
794
|
+
post_me = add_post('text', text, post_me)
|
795
|
+
post_me = add_post('token', token, post_me)
|
796
|
+
post_me = add_post('ccme', ccme, post_me)
|
797
|
+
post_me = add_post('action', 'emailuser', post_me)
|
798
|
+
post_me = format(post_me, 'xml')
|
799
|
+
result = make_request(post_me)
|
800
|
+
return result
|
801
|
+
end
|
802
|
+
|
803
|
+
def undelete(title = nil, token = nil, reason = nil, timestamps = nil, post_me = nil)
|
804
|
+
|
805
|
+
post_me = add_post('title', title, post_me)
|
806
|
+
post_me = add_post('token', token, post_me)
|
807
|
+
post_me = add_post('reason', reason, post_me)
|
808
|
+
post_me = add_post('timestamps', timestamps, post_me)
|
809
|
+
post_me = add_post('action', 'undelete', post_me)
|
810
|
+
post_me = format(post_me, 'xml')
|
811
|
+
result = make_request(post_me)
|
812
|
+
return result
|
813
|
+
end
|
814
|
+
|
815
|
+
def import(token = nil, summary = nil, xml = nil, interwikisource = nil, interwikipage = nil, fullhistory = nil, templates = nil, namespace = nil, post_me = nil)
|
816
|
+
|
817
|
+
post_me = add_post('token', token, post_me)
|
818
|
+
post_me = add_post('summary', summary, post_me)
|
819
|
+
post_me = add_post('xml', xml, post_me)
|
820
|
+
post_me = add_post('interwikisource', interwikisource, post_me)
|
821
|
+
post_me = add_post('interwikipage', interwikipage, post_me)
|
822
|
+
post_me = add_post('fullhistory', fullhistory, post_me)
|
823
|
+
post_me = add_post('templates', templates, post_me)
|
824
|
+
post_me = add_post('namespace', namespace, post_me)
|
825
|
+
post_me = add_post('action', 'import', post_me)
|
826
|
+
post_me = format(post_me, 'xml')
|
827
|
+
result = make_request(post_me)
|
828
|
+
return result
|
829
|
+
end
|
830
|
+
|
831
|
+
def unblock(id = nil, user = nil, token = nil, gettoken = nil, reason = nil, post_me = nil)
|
832
|
+
|
833
|
+
post_me = add_post('id', id, post_me)
|
834
|
+
post_me = add_post('user', user, post_me)
|
835
|
+
post_me = add_post('token', token, post_me)
|
836
|
+
post_me = add_post('gettoken', gettoken, post_me)
|
837
|
+
post_me = add_post('reason', reason, post_me)
|
838
|
+
post_me = add_post('action', 'unblock', post_me)
|
839
|
+
post_me = format(post_me, 'xml')
|
840
|
+
result = make_request(post_me)
|
841
|
+
return result
|
842
|
+
end
|
843
|
+
|
844
|
+
# method for adding common parameters for all the methods of the type
|
845
|
+
# query
|
846
|
+
def query(post_me = nil, titles = nil, pageid = nil, revids = nil, redirects = nil, indexpageids = nil, export = nil, exportnowrap = nil)
|
847
|
+
post_me = add_post('titles', titles, post_me)
|
848
|
+
post_me = add_post('pageid', pageid, post_me)
|
849
|
+
post_me = add_post('revids', revids, post_me)
|
850
|
+
post_me = add_post('redirects', redirects, post_me )
|
851
|
+
post_me = add_post('indexpageids', indexpageids, post_me)
|
852
|
+
post_me = add_post('export', export, post_me)
|
853
|
+
post_me = add_post('exportnowrap', exportnowrap, post_me)
|
854
|
+
post_me = add_post('action', 'query', post_me)
|
855
|
+
return post_me
|
856
|
+
end
|
857
|
+
|
858
|
+
#method for defining the format. Currently overriden at make_request
|
859
|
+
def format(post_me, format = nil)
|
860
|
+
post_me = add_post('format', format, post_me)
|
861
|
+
return post_me
|
862
|
+
end
|
863
|
+
|
864
|
+
#based on rwikibot by Eddie Roger, this method makes a post request to
|
865
|
+
#the api using the values specified at post_this and the cookies obtained
|
866
|
+
#during the login (if available)
|
867
|
+
#
|
868
|
+
#Returns a xml with the result of the query
|
869
|
+
def make_request(post_this)
|
870
|
+
if !post_this.key?('format') or !post_this['format']
|
871
|
+
post_this['format'] = 'xml'
|
872
|
+
end
|
873
|
+
|
874
|
+
if @config['logged']
|
875
|
+
cookies= "#{@config['cookieprefix']}UserName=#{@config['lgusername']}; #{@config['cookieprefix']}UserID=#{@config['lguserid']}; #{@config['cookieprefix']}Token=#{@config['lgtoken']}; #{@config['cookieprefix']}_session=#{@config['_session']}"
|
876
|
+
else
|
877
|
+
cookies = ""
|
878
|
+
end
|
879
|
+
|
880
|
+
headers = {
|
881
|
+
'User-agent'=>Ourconfig['user-agent'],
|
882
|
+
'Cookie' => cookies
|
883
|
+
}
|
884
|
+
uri = URI.parse(@config['api_url'])
|
885
|
+
request = Net::HTTP::Post.new(uri.path, headers)
|
886
|
+
request.set_form_data(post_this)
|
887
|
+
response = Net::HTTP.new(uri.host, uri.port).start { |http|
|
888
|
+
http.request(request)
|
889
|
+
}
|
890
|
+
resputf8 = '<?xml version="1.0" encoding="UTF-8" ?>'+response.body[21..-1]
|
891
|
+
|
892
|
+
return_result = XmlSimple.xml_in(resputf8, { 'ForceArray' => false })
|
893
|
+
return return_result
|
894
|
+
end
|
895
|
+
|
896
|
+
def add_post(key, value, post_me = nil)
|
897
|
+
if !post_me
|
898
|
+
post_me = Hash.new()
|
899
|
+
end
|
900
|
+
if value
|
901
|
+
post_me[key]=value
|
902
|
+
end
|
903
|
+
return post_me
|
904
|
+
end
|
905
|
+
end
|
906
|
+
|
907
|
+
#code from rwikibot
|
908
|
+
class Hash
|
909
|
+
def to_s
|
910
|
+
out = "{"
|
911
|
+
self.each do |key, value|
|
912
|
+
out += "#{key} => #{value},"
|
913
|
+
end
|
914
|
+
out = out.chop
|
915
|
+
out += "}"
|
916
|
+
end
|
917
|
+
end
|