summaryrefslogtreecommitdiff
path: root/block-spammers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'block-spammers.rb')
-rwxr-xr-xblock-spammers.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/block-spammers.rb b/block-spammers.rb
new file mode 100755
index 0000000..bfd6dac
--- /dev/null
+++ b/block-spammers.rb
@@ -0,0 +1,25 @@
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
+
+load 'mwapi.rb'
+require 'yaml'
+require 'pp'
+
+mw = MWApi.new('https://wiki.parabolagnulinux.org/api.php')
+credentials = YAML.load_file('credentials.yml')
+mw.login(credentials['username'], credentials['password'])
+
+file = File.open("/dev/stdin", "rb")
+contents = file.read
+users = contents.split("\n")
+users.each_slice(100) do |list|
+# begin
+ mw.block(list, {
+ :autoblock => '',
+ :noemail => '',
+ :reason => "Spammer (Autodetected: has made edits, but only to deleted pages)",
+ })
+# rescue
+# print "Error blocking users #{list}\n"
+# end
+end