Script to convert Twitter RSS feeds into text

[Update Nov 2012: URLs such as do not work anymore, but you can get a Twitter timeline RSS feed by using, where xxxxx is the screen name such as cnxsoft]

We needed to convert Twitter RSS feeds to UTF-16 text for displaying them into a digital signage (That did not support RSS feed directly).  This digital signage supports regular http download, .e.g every 5 minutes.

Here’s the script (called with crontab) we used for CNN News Twitter RSS feed.


# CNN Twitter
sleep 10
cat 759251.rss | grep title | sed s/\<title\>// | sed s/\<\\/title\>// > cnn.txt
rm 759251.rss
iconv -f utf-8 -t UCS-2LE cnn.txt > cnn-utf16.txt
cp cnn-utf16.txt /var/www/html/livepics/cnn.txt

The resulting text file looks like:

Twitter / CNN
CNN: BREAKING NEWS: Military: Last U.S. brigade combat team leaves Iraq; 56,000 troops remain. Fifty-thousand set to stay past August 31.
CNN: NY Gov. David Paterson discusses Islamic cultural center debate tonight at 9ET on &#8216;Larry King Live.&#8217;

and can be download using a URL, e.g.

This works with any Twitter feed including CNXSoft feed :).

Share this:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies or become a Patron on Patreon

ROCK Pi 4C Plus

Leave a Reply

Your email address will not be published. Required fields are marked *

Khadas VIM4 SBC
Khadas VIM4 SBC