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(/