From 9a688fc5c6e472fdb1317937a77504f7f9e96beb Mon Sep 17 00:00:00 2001 From: neingeist Date: Fri, 14 Oct 2005 01:15:48 +0000 Subject: [PATCH] add a few more category methods --- mediawikibot.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/mediawikibot.rb b/mediawikibot.rb index be47517..1269305 100755 --- a/mediawikibot.rb +++ b/mediawikibot.rb @@ -36,6 +36,10 @@ class WikiBot def url_no_redirect (title) return @wiki + "index.php?title=" + url_encode(title) + "&redirect=no" end + + def url_page (title) + return @wiki + "index.php?title=" + url_encode(title) + end def url_raw (title) return @wiki + "index.php?title=" + url_encode(title) + "&action=raw" @@ -197,6 +201,31 @@ class WikiBot return articles end + def get_categories(title) + + if is_redirect?(title) + return [] + end + + categories = [] + categories_html = @client.get_content(url_page(title)).scan(/