diff options
Diffstat (limited to 'delete-stdin.rb')
-rwxr-xr-x | delete-stdin.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/delete-stdin.rb b/delete-stdin.rb new file mode 100755 index 0000000..730d1d6 --- /dev/null +++ b/delete-stdin.rb @@ -0,0 +1,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 |