feed2omb – A feed to microblog posting tool

Update: For the latest version and up to date documentation, please see the project page.

feed2omb is a simple tool that takes input from Atom or RSS feeds and posts updates to the open microblogging service of your choice. It should also (though I’m not going to try it) quite happily post to Twitter.

The feed reading is handled by Mark Pilgrim’s excellent Universal Feed Parser so it should be able to deal with any feed you throw at it. On the posting side, you can send the updates to open microblogging services such as those based on Laconica – this includes Identica.

Installation:

You should be able to run this on any operating system where you can install Python (tested with 2.5). In addition to feed2omb itself, you need the Universal Feed Parser and ConfigObj. Both dependencies can either be installed properly or just placed in the same directory as feed2omb.

Usage:

Create one or more config files (one for each feed) using the sample.config file as an example.

Run feed2omb.py --update --test yours.config to check everything is working. This will not post anything, but just output the new messages it finds. If everything looks good, you can run again with the –test option and schedule this to run on a regular basis.

You can specify as many config files as you need – each will be processed in turn. For help on the command line, use feed2omb.py --help.

Other Options

Instead of --update, you can specify --eat. In this case, new messages found will be marked as sent, but will not actually be sent. This is useful when setting up a new feed, to prevent the sending of lots of old items.

The --max restricts processing to a specified number of items per run. For example, specify --max=1 to only process one item. When set up this way, even if there are multiple new items in the feed, only one (the oldest) will be processed on each run. This can be used to avoid flooding the omb service with a batch of messages all at once.

FAQ:

Q: Now twitterfeed.com supports Laconica, why not just use that or something like it?

A: That would be easier, but: a) you have to give it your account details, b) it’s not ‘open’ and you can’t customise it, and c) you might be running a private Laconica instance on a non-public network.

Q: Where’s the source code?

A: In the zipped download (see above), or you can browse the git repository or clone it using git from there – e.g.:

   git clone http://git.ciarang.com/feed2omb.git

Q: What license is this released under?

A: AGPL v3

Q: Can it output the author’s name along with the entry’s title?

A: Yes, version 0.5 adds a ‘msgmode’ setting to the config file. With this set to ‘title’ (the default) just the entry’s title is sent. Setting it to ‘authtitle’ sends the author’s name followed by the title – this is useful for feeds with multiple authors, or aggregated feeds such as those sourced from a Planet installation.

Q: Why isn’t my question answered here?

A: You haven’t asked it yet. Ask me.

  1. børge’s avatar

    Can I use this on Dreamhost without a lot of haxx0r skillz? :)

    Reply

  2. CiaranG’s avatar

    @børge – I’ve never used Dreamhost but from a quick look at their features list I think the answer is probably yes. You would need to:

    1. Download feed2omb and the two dependencies (all links above) to a directory on your computer.
    2. Copy sample.config to yourname.config and edit it so it does what you want.
    3. Upload the whole lot to your Dreamhost account using FTP. It would need to go OUTSIDE your public_html directory – you don’t want this accessible through the web server.
    4. Set up a cron task to run “/whereyouputit/feed2omb.py -u yourname.confg” every 30 minutes, every hour, or whatever.

    If you try it, let me know what happens – I’ll try to help out if possible.

    Reply

  3. highzeth’s avatar

    Working great apart from a little UTF-8 encoding it seems? =)

    –snip–
    Found new entry: http://www.digi.no/php/art.php?id=784334
    Sending new message:
    Traceback (most recent call last):
    File “feed2omb.py”, line 68, in ?
    print ‘ ‘+text
    UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xf8′ in position 15: ordinal not in range(128)
    –snip–

    Reply

  4. CiaranG’s avatar

    Oops. Thanks for the report – I’ll get it fixed.

    Reply

  5. CiaranG’s avatar

    Ok, try version 0.3 – new zip file linked above, or get the source from the repository. It was just the console output that was the problem, and it should be ok now. Strangely, the Norwegian characters worked fine on my UK Linux and Windows machines, but if it still doesn’t work for you let me know your operating system and locale settings.

    Reply

  6. highzeth’s avatar

    The .no chars are displayed upon -u -t, as well as -u now. So its progress since it didnt show æøå in konsoll upon fetching in v0.2.

    Ive tried this on Ubuntu (gutsy & hardy), and Gentoo, same locales.

    –snip–
    Sending new message:
    Kraftig fartsøkning for populært minnekort – http://bit.ly/Vk5QK
    Traceback (most recent call last):
    File “feed2omb.py”, line 80, in
    resp=opener.open(config['apibaseurl']+’/statuses/update.xml’,urlencode(data))
    File “/usr/lib/python2.5/urllib.py”, line 1250, in urlencode
    v = quote_plus(str(v))
    UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xf8′ in position 13: ordinal not in range(128)
    –snip–

    root@fun:~/feed2omb# locale -a
    C
    en_AU.utf8
    en_BW.utf8
    en_CA.utf8
    en_DK.utf8
    en_GB.utf8
    en_HK.utf8
    en_IE.utf8
    en_IN
    en_NZ.utf8
    en_PH.utf8
    en_SG.utf8
    en_US.utf8
    en_ZA.utf8
    en_ZW.utf8
    it_CH.utf8
    it_IT.utf8
    nb_NO.utf8
    no_NO.utf8
    POSIX
    —-

    So you have working posting with a .no feed in your setup?
    http://digi.no/rss is the feed Im pulling above, thanx for the respons & work you have done! =)

    Reply

  7. CiaranG’s avatar

    Version 0.4 should solve the remaining unicode problem. I tried it with the feed you gave – the examples here look right to me: http://micro.ciarang.com/test1/all

    There are a couple of new command-line options too, which I’ve documented above.

    Reply

  8. highzeth’s avatar

    Superb! All works, thanx. =)

    Reply

  9. CiaranG’s avatar

    Updated for version 0.5 – new ‘msgmode’ config option and a bug fix for the –max option.

    Reply

  10. Børge’s avatar

    highzeth: This is interesting! Are you making an account for digi.no on identi.ca, or another Laconica based micro blog? What’s your account? I’m making a list of all Norwegians on identi.ca! :)

    Reply

  11. highzeth’s avatar

    @Børge no I was just testing various .no RSS feeds. =)

    I can be found at; http://fun.ohhh.no/hz primarly.

    Reply

  12. Børge’s avatar

    hz: Aha, so that’s you. I should’ve guessed! Then We’re already following each other! :) Are there any other norwegians I should follow on fun?

    Reply

  13. highzeth’s avatar

    I have no idea, Im a man that hates borders. =)

    Reply

  14. mippe’s avatar

    mibbul@kek:~$ python /home/XXX/feed2omb/feed2omb.py –update –test identica.config
    feed2omb version 0.5
    Copyright 2008 Ciaran Gultnieks

    Reading config: identica.config
    Reading feed…
    Traceback (most recent call last):
    File “/home/XXX/feed2omb/feed2omb.py”, line 64, in ?
    feed=feedparser.parse(config['feedurl'])
    File “/home/XXX/feed2omb/configobj.py”, line 580, in __getitem__
    val = dict.__getitem__(self, key)
    KeyError: ‘feedurl’

    Help! :(

    Reply

    1. CiaranG’s avatar

      @mippe – looks like you are missing the feedurl in your config file.

      Reply

  15. CiaranG’s avatar

    There is much more documentation, and the latest version, at http://projects.ciarang.com/p/feed2omb.

    You can also log bugs and feature requests in the tracker there.

    Reply