FANDOM


Forums: Index > Watercooler > Bot for overview hexcode and pictures


What I'd like, if possible, is to have a bot or a page that automatically updates to be like a category page. The difference is, I want the items to show up in a table with the hexcode and a picture or visual reference. Is this too big of a project? --Bejjinks 02:04, 7 September 2008 (UTC)

For a bot we need an external computer, like yours or me and a program where runs the bot and makes the changes. This is no big deal. But before start such, I need a visually preview how should view the output of such page. Is User:HenryNe/test an output you means? Please change it, how you like. Are this more as one page? We can not put all pictures into one page. We need some different pages? Or means you the bot should edit the "summary" on category pages? —HenryNe 07:36, 9 September 2008 (UTC)

I'm not thinking about the main page when I talk about a bot. Check out User:Bejjinks/test for two examples of what I'm hoping a bot can do. --Bejjinks 01:00, 10 September 2008 (UTC)

Ok, understand. Create a table for every Category with an overview of articles. This is doable — I'm locking for code snips for bots in generally. It's many years ago, I was using a bot on Mediawiki. —HenryNe 22:29, 10 September 2008 (UTC)

Hello Bejjinks, I wand let a short note about status here. The test page was a mistaken with name of page, but the bot has created it. :) Now I can start coding the content from your examples. --HenryNe 20:02, 17 September 2008 (UTC)

Haven't heard from HenryNe in about a month. I'd like to know the status of the bot please.--Bejjinks 19:25, 17 October 2008 (UTC)

Sorry, I not found free time for continue the bot. What I only have is a configuration to get a list from Category and write the contents to a new page. Here are things I used:

  • Download pywikipedia bot, last Snapshot from http://pywikipediabot.sourceforge.net/, I used SVN revision r5894.
  • I used Python 2.5.1 on Linux. For Windows you also need to install Python
  • Create a family file "families/color_family.py":
# -*- coding: utf-8  -*-
import family

class Family(family.Family):
    def __init__(self):
        family.Family.__init__(self)
        self.name = 'color'

        self.langs = {
            'en': None,
            }

        self.namespaces[4] = {
            '_default': u'Color Sorting',
        }
        self.namespaces[5] = {
            '_default': u'Color Sorting talk',
        }
        self.namespaces[110] = {
            '_default': u'Forum',
        }
        self.namespaces[111] = {
            '_default': u'Forum talk',
        }

        self.languages_by_size = ['en']

        alphabetic = ['en']

    def hostname(self,code):
        return 'color.wikia.com'

    def code2encoding(self,code):
        return 'utf-8'

    def version(self, code):
        return '1.13.2'

    def path(self, code):
        return '/index.php'

    def apipath(self, code):
        return '/api.php'

    def scriptpath(self, code):
        return ''

If you got a version warning, then change the '1.13.2' to current version Wikia currently used.

  • Create a config file "user-config.py" and replace my username 'HenryNe' with yours:
mylang = 'en'
family = 'color'
usernames['color']['en'] = 'HenryNe'
  • Run the login script
python login.py
This is a normal output from login where you needs to enter your Wikia password:
Checked for running processes. 1 processes currently running, including the current process.
Password for user HenryNe on color:en:********
Logging in to color:en as HenryNe
WARNING: Your account on color:en does not have a bot flag. Its edits will be visible in the recent changes and it may get blocked.
Should be logged in now

The warning about bot flag is normal, you can ignore this message.

  • The page list1.txt was created with follow command:
python category.py listify
The listify ask than for category and filename. The filename is the name of the new Wiki page.
Checked for running processes. 1 processes currently running, including the current process.
Reading dump from category.dump.bz2
Please enter the name of the category to listify: Colors of drink
Please enter the name of the list to create: list1.txt
Getting [[Category:Colors of drink]]...
WARNING: Your account on color:en does not have a bot flag. Its edits will be visible in the recent changes and it may get blocked.
WARNING: Your account on color:en does not have a bot flag. Its edits will be visible in the recent changes and it may get blocked.
Retrieving watchlist for color:en
WARNING: Your account on color:en does not have a bot flag. Its edits will be visible in the recent changes and it may get blocked.
Parsing watchlist
Creating page [[en:List1.txt]]
Dumping to category.dump.bz2, please wait...

The next todo is to get the list from category, store it locally in a file (not post to Wiki as listify does), parse the contents, get the hexcolor and picture from article page and create the table. Than upload the page to Wikia with 'python pagefromfile.py'. —HenryNe 13:02, 2 November 2008 (UTC)

Community content is available under CC-BY-SA unless otherwise noted.