Twitter to RSS
- Resolves links and embeds pictures, YouTube and other services (besides pictures, all of them require that your RSS reader supports iframes).
- Uses an SQLite backend to cache resolved urls and stuff.
- Create a Twitter account.
- Create an app on https://apps.twitter.com/
- Copy consumer key and consumer secret to variables at the top of
- Run the script to get a bearer token.
- Copy the bearer token to the source code.
- Set up the feeds in your favorite reader, using e.g.
- Make sure the url resolution database is created. Otherwise you can try:
touch twitter-rss.db; chmod 666 twitter-rss.db
To get history
- You will be redirected to
- This url can be used to fetch all tweets for 30 minutes, after that, it will behave like normal, only fetching the last 200 tweets. The reason for this is to prevent your feed reader from using up the Twitter API limit.
- Add this url to your feed reader before the timer runs out. You may have to get a new url since resolving the urls probably took a while.
- Note that the API limits the number of tweets you can get to about 3200 tweets.
To clean up the database (remove urls not seen in the last three days):
sqlite3 twitter-rss.db "DELETE FROM urls WHERE last_seen < strftime('%s','now','-3 days'); VACUUM;"
You may want to create an index on the urls table:
CREATE INDEX url ON urls (url)
- It seems that links created in 2011 and earlier don't always have their urls as entities (they are not even autolinked when viewing them on twitter.com).
- Old tweets don't escape ampersands either.
- 180 requests can be done per 15 minutes.
- TODO: Make sure we don't hit the limit.
- Check your limits by going to
- The PHP extensions
php_opensslmust be enabled.