Wulf's Webden

The Webden on WordPress

Tweet to Blog

| 0 comments

You may have noticed that, after my “twelve days of Christmas” blogging break I returned with a run of very short posts. This is the fruit of a project I have had in mind for a long time but needed that extra space to get completed, taking selected “tweets” from my twitter feed and inserting them into my blog. Let me briefly explain how and why?

Practical details first. I have written a PHP script that contacts Twitter via its API, extracts a list of all my tweets since it was last run (by tweet id – see example) and writes certain tweets to text files. These are are picked up by the Blosxom blog engine I use and displayed as blog postings. My flag for bloggable tweets are ones that start with a full stop. This is small enough to not interfere with normal twittering and unusual enough to act as an identifier. The First sentence is transformed into the title of the post and the rest becomes the text.

Having mastered processing the XML feed, producing any required blog posts and updating the last id so that I do not end up reposting tweets, I then needed to figure out how to get the script to run automatically. After a few abortive experiments, I ended up writing a very simple Perl script that runs every 15 minutes via a cron entry on my web server.

The presentation of the posts could be improved but the technical problems have been mastered. That leads to the second question, why? I wanted an easy method to write short blog posts. Sometimes I am pressed for time and sometimes all I want to do is make a short comment or share a URL. Now that the system is running I can do that as easily as sending a tweet and even make updates from my mobile.

My next blog-improvement challenge is to upgrade the commenting system. Hooking into Flickr (another API experiment) has been handy but it is relatively time consuming to link to the picture used for commenting on a given post. I am also beginning to approach the photos that attracted more comments in their own rights on the Flickr site, which will mean it takes even longer to pick through and find an image to hook into. Meanwhile, if you have some technical skills and would like the two scripts involved, let me know in the comments or via Twitter or Facebook.

Want to add something? Please join the conversation about this posting (nb. Yahoo! account required to log into Flickr).

Technorati Tags:

Leave a Reply

Required fields are marked *.


This site uses Akismet to reduce spam. Learn how your comment data is processed.