summaryrefslogtreecommitdiff
path: root/delete-stdin.rb
blob: 730d1d6a5350dec778911eb63783fbd269d64996 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/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
titles = contents.split("\n")
titles.each_slice(100) do |list|
	mw.delete_by_title(list, { :reason => 'Spam' });
end