« »
9/10/2013

How I "hijacked" Topsy private search api to remove my first 5000+ tweets

[Update] This article was only a proof of concept oriented towards developers. Please don't ask for help in order to use this script because it may not work at all.


When my cofounder at Bringr told me that Topsy new search engine was able to look at every tweet published since 2006 I immediately tried to search my username to see my first tweets.

What a horrible sight, my first tweets from 2007 were disastrous, both in grammar and in content. In France, we like to think that we believe in what I would translate as the right to be forgotten (Le droit à l'oubli), in short it's the right be protected from search engine indexing things we posted years ago. Because sometimes we publish things online that we'll regret some years later (just look at all those kids that share too much of their personal lives on Twitter or Facebook).

So while I was playing with Topsy, I looked at the network exchange and discovered Topsy own search api.

Topsy private api
The endpoint:

http://otter.topsy.com/search.js?q={query}&offset=10&perpage={10-5000+}&window=a&sort_method=-date&apikey={apikey}

What's awesome about this endpoint is that perpage parameter allows to request more than 5000 tweets with just one call! I quickly wrote a (Java)Script (got it?) to download all those tweets and remove each one of them thanks to Twitter API own API. And it worked.

As usual the script is available on Github. Just edit the config.js file and run it. You'll need to create your own Twitter application and copy/paste your consumer_key/secret and access_token/secret.

Since Topsy does not require a login I wonder if they use the same apikey for everyone, don't hesitate to post your own observation on this matter!

git clone git@github.com:FGRibreau/twitterremover.git
cd twitterremover
npm install
vim config.js
node destroyThemAll


Oh, one last thing, because it's a private API you have no guarantee that this endpoint will work forever so don't build anything serious on it :).

Thanks for reading that far! If you liked it you may like what I share on

NB: Another way to achieve the same result would be to request a Twitter archive and then write a script to read it... but that would take all the fun away!
« »
 
 
Made with on a hot august night.