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 ""

Want to comment? Send me an email to blog-comments-2018 at lemmster d.t de and I'll paste it here (I won't publish your address). Why don't you use an external comment service like disqus, you ask? Well, I like to keep this site under my control, comments included. You can use markdown to format your comment.