Posts Tagged ‘debill’

Following twitter hashtags on TV

Tuesday, April 6th, 2010

DSC06104As a lot of other people, I’m watching the debate of the Digital Economy Bill on BBC Parliament tonight. I’m also trying to follow along with some of the #debill back-channel on twitter.

With such a heated and interesting commentary on twitter, it reminded me of Roo’s “Second screen” idea of having tweets with a specific hashtag next to the TV during live TV events, when following the twitter backchannel during ‘The Apprentice’.

Unfortunately, I don’t have a spare laptop kicking around to show tweets on. But I do have a hackable TV. 🙂

With that in mind, in just a few minutes I hacked together the following script to flash up tweets with the #debill tag on the TV:

# run me using:
#       python twittertv.py debill 1

import twython
import subprocess
import sys
from time import sleep

twitterKeyword = sys.argv[1]
twitterSearchRateLimitMins = int(sys.argv[2])

twitter = twython.core.setup()

showOnTVCommand = ['svdrpsend', 'mesg', 'messagetodisplay']

lasttweetid = 1

while True:
    search_results = twitter.searchTwitter(twitterKeyword, since_id=lasttweetid, show_user=True)

    numtweets = len(search_results["results"])
    for tweetnum in reversed(range(0, numtweets)):
        lasttweetid = search_results["results"][tweetnum]["id"]

        user = search_results["results"][tweetnum]["from_user"]
        tweet = search_results["results"][tweetnum]["text"]
        showOnTVCommand[2] = user + " : " + tweet

        subprocess.Popen(showOnTVCommand)
        sleep(20)

    sleep(twitterSearchRateLimitMins * 60)

DSC06127

It’s a quick-and-dirty hack, but I wanted to get something that would work before the debate was finished. 🙂

And it seems to do the trick.