mediawiki-butt 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mediawiki/administration.rb +1 -1
- data/lib/mediawiki/auth.rb +1 -1
- data/lib/mediawiki/butt.rb +3 -2
- data/lib/mediawiki/query/lists.rb +13 -12
- data/lib/mediawiki/query/properties/contributors.rb +3 -1
- data/lib/mediawiki/query/properties/files.rb +4 -2
- data/lib/mediawiki/query/properties/pages.rb +8 -6
- data/lib/mediawiki/query/properties/properties.rb +1 -1
- data/lib/mediawiki/query/query.rb +5 -7
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8287cc51bbd45b0b63fb8c16b5b86b74848b3e85
|
4
|
+
data.tar.gz: 33b65213c477787cbfbf00ae5c834cf2d24705f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c14f1a0202eb3e5c4614fb1c43e59556162215162cdb1b22f570e00030254377f5cf3c61fbabbc2d4a75ffb38081f9f6e8674648262a1a2431c0834fb828df1e
|
7
|
+
data.tar.gz: 5fb48bb4ef5ab53fa247581a05132e46e7de00a7a81a90a03c87d1024bdd52210fd159032b12659fe3002cb3dfa2980e329cc5f444047644158efffe093993c8
|
data/lib/mediawiki/auth.rb
CHANGED
@@ -14,7 +14,7 @@ module MediaWiki
|
|
14
14
|
@logged_in = true
|
15
15
|
return true
|
16
16
|
when 'NeedToken'
|
17
|
-
fail MediaWiki::Butt::NeedTokenMoreThanOnceError if secondtry
|
17
|
+
fail MediaWiki::Butt::NeedTokenMoreThanOnceError if secondtry
|
18
18
|
when 'NoName'
|
19
19
|
fail MediaWiki::Butt::NoNameError
|
20
20
|
when 'Illegal'
|
data/lib/mediawiki/butt.rb
CHANGED
@@ -9,6 +9,7 @@ require 'json'
|
|
9
9
|
module MediaWiki
|
10
10
|
class Butt
|
11
11
|
include MediaWiki::Auth
|
12
|
+
include MediaWiki::Query
|
12
13
|
include MediaWiki::Query::Meta::SiteInfo
|
13
14
|
include MediaWiki::Query::Meta::FileRepoInfo
|
14
15
|
include MediaWiki::Query::Meta::UserInfo
|
@@ -75,10 +76,10 @@ module MediaWiki
|
|
75
76
|
# the currently logged in user if nil.
|
76
77
|
# @return [Boolean] true if logged in as a bot, false if not logged in or
|
77
78
|
# logged in as a non-bot
|
78
|
-
def user_bot?(
|
79
|
+
def user_bot?(username = nil)
|
79
80
|
groups = false
|
80
81
|
|
81
|
-
if
|
82
|
+
if !username.nil?
|
82
83
|
groups = get_usergroups(username)
|
83
84
|
else
|
84
85
|
groups = get_usergroups if @logged_in
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative '../constants'
|
2
|
+
require_relative 'query'
|
2
3
|
|
3
4
|
module MediaWiki
|
4
5
|
module Query
|
@@ -14,7 +15,7 @@ module MediaWiki
|
|
14
15
|
action: 'query',
|
15
16
|
list: 'backlinks',
|
16
17
|
bltitle: title,
|
17
|
-
bllimit:
|
18
|
+
bllimit: get_limited(limit)
|
18
19
|
}
|
19
20
|
|
20
21
|
ret = []
|
@@ -37,7 +38,7 @@ module MediaWiki
|
|
37
38
|
action: 'query',
|
38
39
|
list: 'categorymembers',
|
39
40
|
cmprop: 'title',
|
40
|
-
cmlimit:
|
41
|
+
cmlimit: get_limited(limit)
|
41
42
|
}
|
42
43
|
|
43
44
|
if category =~ /[Cc]ategory\:/
|
@@ -63,7 +64,7 @@ module MediaWiki
|
|
63
64
|
params = {
|
64
65
|
action: 'query',
|
65
66
|
list: 'random',
|
66
|
-
rnlimit:
|
67
|
+
rnlimit: get_limited(number_of_pages, 10, 20)
|
67
68
|
}
|
68
69
|
|
69
70
|
if @namespaces.value?(namespace)
|
@@ -275,7 +276,7 @@ module MediaWiki
|
|
275
276
|
params = {
|
276
277
|
action: 'query',
|
277
278
|
list: 'allcategories',
|
278
|
-
aclimit:
|
279
|
+
aclimit: get_limited(limit)
|
279
280
|
}
|
280
281
|
|
281
282
|
response = post(params)
|
@@ -294,7 +295,7 @@ module MediaWiki
|
|
294
295
|
params = {
|
295
296
|
action: 'query',
|
296
297
|
list: 'allimages',
|
297
|
-
ailimit:
|
298
|
+
ailimit: get_limited(limit)
|
298
299
|
}
|
299
300
|
|
300
301
|
response = post(params)
|
@@ -314,7 +315,7 @@ module MediaWiki
|
|
314
315
|
action: 'query',
|
315
316
|
list: 'allpages',
|
316
317
|
apnamespace: namespace,
|
317
|
-
aplimit:
|
318
|
+
aplimit: get_limited(limit)
|
318
319
|
}
|
319
320
|
|
320
321
|
response = post(params)
|
@@ -333,7 +334,7 @@ module MediaWiki
|
|
333
334
|
params = {
|
334
335
|
action: 'query',
|
335
336
|
list: 'allusers',
|
336
|
-
aulimit:
|
337
|
+
aulimit: get_limited(limit)
|
337
338
|
}
|
338
339
|
params[:augroup] = group unless group.nil?
|
339
340
|
|
@@ -353,7 +354,7 @@ module MediaWiki
|
|
353
354
|
params = {
|
354
355
|
action: 'query',
|
355
356
|
list: 'blocks',
|
356
|
-
bklimit:
|
357
|
+
bklimit: get_limited(limit),
|
357
358
|
bkprop: 'id'
|
358
359
|
}
|
359
360
|
|
@@ -374,7 +375,7 @@ module MediaWiki
|
|
374
375
|
action: 'query',
|
375
376
|
list: 'embeddedin',
|
376
377
|
eititle: page,
|
377
|
-
eilimit:
|
378
|
+
eilimit: get_limited(limit)
|
378
379
|
}
|
379
380
|
|
380
381
|
response = post(params)
|
@@ -393,7 +394,7 @@ module MediaWiki
|
|
393
394
|
params = {
|
394
395
|
action: 'query',
|
395
396
|
list: 'filearchive',
|
396
|
-
falimit:
|
397
|
+
falimit: get_limited(limit)
|
397
398
|
}
|
398
399
|
|
399
400
|
response = post(params)
|
@@ -412,7 +413,7 @@ module MediaWiki
|
|
412
413
|
params = {
|
413
414
|
action: 'query',
|
414
415
|
list: 'protectedtitles',
|
415
|
-
ptlimit:
|
416
|
+
ptlimit: get_limited(limit)
|
416
417
|
}
|
417
418
|
params[:ptlevel] = protection_level unless protection_level.nil?
|
418
419
|
|
@@ -435,7 +436,7 @@ module MediaWiki
|
|
435
436
|
action: 'query',
|
436
437
|
list: 'usercontribs',
|
437
438
|
ucuser: user,
|
438
|
-
uclimit:
|
439
|
+
uclimit: get_limited(limit),
|
439
440
|
ucprop: 'ids|title|comment|size|sizediff|flags|patrolled'
|
440
441
|
}
|
441
442
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative '../query'
|
2
|
+
|
1
3
|
module MediaWiki
|
2
4
|
module Query
|
3
5
|
module Properties
|
@@ -46,7 +48,7 @@ module MediaWiki
|
|
46
48
|
action: 'query',
|
47
49
|
prop: 'contributors',
|
48
50
|
titles: title,
|
49
|
-
pclimit:
|
51
|
+
pclimit: get_limited(limit)
|
50
52
|
}
|
51
53
|
|
52
54
|
post(params)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative '../query'
|
2
|
+
|
1
3
|
module MediaWiki
|
2
4
|
module Query
|
3
5
|
module Properties
|
@@ -12,7 +14,7 @@ module MediaWiki
|
|
12
14
|
action: 'query',
|
13
15
|
prop: 'duplicatefiles',
|
14
16
|
titles: title,
|
15
|
-
dflimit:
|
17
|
+
dflimit: get_limited(limit)
|
16
18
|
}
|
17
19
|
|
18
20
|
response = post(params)
|
@@ -34,7 +36,7 @@ module MediaWiki
|
|
34
36
|
action: 'query',
|
35
37
|
generator: 'allimages',
|
36
38
|
prop: 'duplicatefiles',
|
37
|
-
dflimit:
|
39
|
+
dflimit: get_limited(limit)
|
38
40
|
}
|
39
41
|
|
40
42
|
response = post(params)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative '../query'
|
2
|
+
|
1
3
|
module MediaWiki
|
2
4
|
module Query
|
3
5
|
module Properties
|
@@ -85,7 +87,7 @@ module MediaWiki
|
|
85
87
|
action: 'query',
|
86
88
|
titles: page,
|
87
89
|
prop: 'extlinks',
|
88
|
-
ellimit:
|
90
|
+
ellimit: get_limited(limit)
|
89
91
|
}
|
90
92
|
|
91
93
|
response = post(params)
|
@@ -302,7 +304,7 @@ module MediaWiki
|
|
302
304
|
action: 'query',
|
303
305
|
prop: 'images',
|
304
306
|
titles: page,
|
305
|
-
imlimit:
|
307
|
+
imlimit: get_limited(limit)
|
306
308
|
}
|
307
309
|
|
308
310
|
response = post(params)
|
@@ -330,7 +332,7 @@ module MediaWiki
|
|
330
332
|
action: 'query',
|
331
333
|
prop: 'templates',
|
332
334
|
titles: page,
|
333
|
-
tllimit:
|
335
|
+
tllimit: get_limited(limit)
|
334
336
|
}
|
335
337
|
|
336
338
|
response = post(params)
|
@@ -358,7 +360,7 @@ module MediaWiki
|
|
358
360
|
action: 'query',
|
359
361
|
prop: 'iwlinks',
|
360
362
|
titles: page,
|
361
|
-
tllimit:
|
363
|
+
tllimit: get_limited(limit)
|
362
364
|
}
|
363
365
|
|
364
366
|
response = post(params)
|
@@ -388,7 +390,7 @@ module MediaWiki
|
|
388
390
|
action: 'query',
|
389
391
|
prop: 'langlinks',
|
390
392
|
titles: page,
|
391
|
-
lllimit:
|
393
|
+
lllimit: get_limited(limit),
|
392
394
|
llprop: 'url|langname|autonym'
|
393
395
|
}
|
394
396
|
|
@@ -422,7 +424,7 @@ module MediaWiki
|
|
422
424
|
action: 'query',
|
423
425
|
prop: 'links',
|
424
426
|
titles: page,
|
425
|
-
pllimit:
|
427
|
+
pllimit: get_limited(limit)
|
426
428
|
}
|
427
429
|
|
428
430
|
response = post(params)
|
@@ -16,7 +16,7 @@ module MediaWiki
|
|
16
16
|
# @return [String] The token. If the butt isn't logged in, it returns
|
17
17
|
# with '+\\'.
|
18
18
|
def get_token(type, title = nil)
|
19
|
-
if @logged_in
|
19
|
+
if @logged_in
|
20
20
|
# There is some weird thing with MediaWiki where you must pass a valid
|
21
21
|
# inprop parameter in order to get any response at all. This is why
|
22
22
|
# there is a displaytitle inprop as well as gibberish in the titles
|
@@ -10,8 +10,6 @@ module MediaWiki
|
|
10
10
|
|
11
11
|
protected
|
12
12
|
|
13
|
-
module_function
|
14
|
-
|
15
13
|
# Gets the limited version of the integer, to ensure nobody provides an int
|
16
14
|
# that is too large.
|
17
15
|
# @param integer [Int] The number to limit.
|
@@ -19,15 +17,15 @@ module MediaWiki
|
|
19
17
|
# @param max_bot [Int] The maximum limit for bot users.
|
20
18
|
# @return [Int] The capped number.
|
21
19
|
def get_limited(integer, max_user = 500, max_bot = 5000)
|
22
|
-
if integer >
|
23
|
-
if user_bot?
|
24
|
-
if integer >
|
25
|
-
return
|
20
|
+
if integer > max_user
|
21
|
+
if user_bot?
|
22
|
+
if integer > max_bot
|
23
|
+
return max_bot
|
26
24
|
else
|
27
25
|
return integer
|
28
26
|
end
|
29
27
|
else
|
30
|
-
return
|
28
|
+
return max_user
|
31
29
|
end
|
32
30
|
else
|
33
31
|
return integer
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mediawiki-butt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eli Foster
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-12-
|
12
|
+
date: 2015-12-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httpclient
|
@@ -25,9 +25,9 @@ dependencies:
|
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 2.6.0.1
|
28
|
-
description:
|
29
|
-
|
30
|
-
|
28
|
+
description: |2+
|
29
|
+
MediaWiki::Butt provides a fully-featured interface to the MediaWiki API. It includes methods for changing wiki content, authentication, and queries.
|
30
|
+
|
31
31
|
email: elifosterwy@gmail.com
|
32
32
|
executables: []
|
33
33
|
extensions: []
|