People use the favorites feature in Twitter differently. The way I use it, is to mark tweets that I want to look up later. I usually access Twitter on the phone, and many times I find interesting tweets that link to websites or articles. I mark these tweets as favorites, and later look them up in a desktop twitter client.
Over time this has left me with a huge number of tweets marked as favorites, and I was looking for an easy way to remove the favorite status from them. The prospect of going through them one by one was not a tempting option, as we are talking about hundreds and thousands of messages. I love to code in Ruby, and John Nunemaker has coded a twitter gem that wraps the Twitter API. From there it was but a short step to write a code snippet that did what I wanted:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
The code above is mostly self explanatory. To use it, you need to register as a developer on the Twitter website to get the required keys and token used for authorization. I am storing the twitter authorization information in a YAML file separate from the code, but for a snippet like this, the keys and tokens could easily be hardcoded directly in the configure method.
The structure of the YAML file is as follows:
1 2 3 4 5 6 | |
I have found this code to be a very convenient way to clean up my Twitter favorites, and hopefully someone else can also find it of use.
![[] [Wacom preferences] [] [Wacom preferences]](/images/20110912_Wacom_prefs.png)