Hacking together an API that returns commonly-used hashtags for the programme you’re watching on the TV
Last April, I wrote a quick-and-dirty Python script that displays tweets for a given hashtag on my TV screen so that I could follow the twitter backchannel about a programme that I watched.
Considering that it was a random idea that was hacked together in a few minutes, I’ve used it a lot since then: it’s made watching a bunch of programmes much more entertaining – Eurovision is probably the best example (the commentary on twitter is hysterical), but there are many others.
But I never made any changes to the script since I first wrote it. If I’m watching something on TV that I know has a hashtag, I ssh to my set-top box and run my hashtags script, giving it the hashtag to filter on in the command.
I was thinking – it’d be much better if it was all automatic. It’d be better if my set-top box automatically showed tweets with the hashtag for whatever programme I’m watching.
To do this, I needed some way of knowing what was the right hashtag for the programme currently on a given TV channel. I could’ve hacked this into my existing script, but I thought it might be a feature that people might find other uses for, so instead I’ve made a stand-alone thing, available as a web-service.
What it does
I’ve made a web feed that returns a blob of either JSON or XML. You can get either:
- the commonly-used hashtag for the programme currently on a specified channel (e.g. “what is the hashtag for the programme that’s on BBC 1 now?”)
- the next programme on TV that has a commonly-used hashtag (e.g. “what are the next five programmes on TV that have hashtags?”)