Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#rc script to publish status to from another microblog (rss). #recycle

This script was written in 2009, when I encountered some problems with

Nowadays, if you want to updates a microblog account from a xml feed, I suggest you use Feed2mb instead.

#!/usr/bin/env rc
### This script publish status to one microblog from another microblog.
# This script can read any microblog which provides rss feed, and write
# to any microblog using the corresponding api. (Currently only support
# But adding support to other microblog is very easy.)
# For the first time, you should manually download the feed and
# specify the date in $workDir/date:
# grep -m 1 '<dc:date>' feed > date
# Copyright: (c) 2009 Jakukyo Friel <>
# License: GPL v2
# config
feedTitle='your twitter'
# config area ends
# seek the line number of the first match
# pattern --> line number
fn seekln {
grep -m 1 -n $* - | cut -f 1 -d : -
# post to
fn postdent {
curl \
-u $auth \
-d status'='$^*
# prepare feed
cd $workDir
curl $feedAddr > feed
# check status
endOfNewItem=`{expr `{cat feed | seekln `(cat date)} - 7}
# record new status
grep -m 1 '<dc:date>' feed > date
# split the rss feed
cat feed |
sed -n 1,`(echo $endOfNewItem)^p |
sed -e '/<title>'$feedTitle'<\/title>/d' |
sed -n '/<title>/p' |
split - -l 1
for (i in `(ls -r x*)) {
cat $i | sed -e 's/<title>//' | sed -e 's/<\/title>//' > output.txt
postdent `(cat output.txt)
sleep 5
# clean up
rm x??
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.