l e m m s t e r . d e
  • Home
  • impressum
  • talks
  • Categories
  • Tags
  • Archives

Custom Twitter timeline rss feed after v1 API retirement

So Twitter has decided to retire its v1 API, breaking everybody's timeline rss feeds (which I happened to use for my blog). Fortunately my twitter client (znc on top of bitblee) logs all my tweets to a text file so create my own rss feed is almost trivial (I haven't bothered to correctly link my tweets though. I plan to eventually migrate away from twitter anyway).

grep -h '<markus>' .znc/users/markus/moddata/log/\#twitter_lemmster_*.log \
> foo.tmp && tac foo.tmp | head -3 | sed 's/<markus> //g' | \
~/bin/lines2rss.sh 'tweets' 'http://www.lemmster.de' 'whatever' \
> /var/www/tweets.xml

line2rss.sh:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
echo '<?xml version="1.0" encoding="UTF-8" ?>'
echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">'
echo '<channel><title>'$1'</title><link>'$2'</link>'
echo '<description>'$3'</description><language>en</language>'
echo '<lastBuildDate>'$(date -R)'</lastBuildDate>'
echo '<pubDate>'$(date -R)'</pubDate>'

i=0
while read line ; do
let "i += 1"

echo '<item><title>'$line'</title>'
echo "<guid>`echo $line | md5sum | cut -f 1 -d ' '`</guid>"
echo '<pubDate>'$(date -d "-$i min" -R)'</pubDate></item>'

done

echo '</channel></rss>'
echo ""

Published

Jun 15, 2013

Category

hacks

Contact

  • Powered by Pelican. Theme: Elegant