archive about

trigger command-line scripts from pubsubhubbub

I’m working on a set of command line tools that will allow my home server (on my ADSL line) to aggregate content (my content, from tumblr, twitter, etc.) and publish it in a blog-like format using bucket3 and amazon S3.

[ note: In order to make this work on your actual home PC/server, you will probably have to use a dynamic DNS service, and set up you router so that port 9000 is mapped to your computer’s 9000 port. ]

A very important piece I was missing was a way to trigger events on my home server when my tumblog is updated.

I decided to rely on pubsubhubbub as tumblr use for their feeds. Here are the steps I followed.

1. I created a simple pubsub “listener” script in python,

- listens to port 9000 on my home server, for requests like ‘/pubsub/…’
- if the request has a “hub.challenge” parameter it replies with its value (this is required during the pubsub registration process, more on this later).
- if the received HTTP Headers include a “LINK:” head, extract the corresponding feed name from it and print it to stdout.
- for all other requests, the listener replies with “OK”.

2. I created an account on (it’s free).

3. Then, I went to>Dashboard->XMPP Console and added a new feed. (make sure your is up and running before adding the feed!)

- feed URL:
- endpoint: http://my_server_name:9000/pubsub/

(If the subscription was successful, make sure you stop before reading on.)

4. Now, I use a script that looks something like this on my home server: whenever is updated, in less than a couple of seconds, superfeedr pings and does the rest.

Yes, it actually works!