With Christmas break in between my classes at Regis, I decided to do a little more playing on my own. I’ve decided to poke at the Twitter REST API since I use Twitter a ton and have some issues with how it works. Creating my own app that references the Twitter API can solve my problems If I can figure out how to use it.
My Twitter issues have to do with the “Twitter ceiling”, a magical ratio that gets to decide how many people we get to follow. I’ve had my Twitter account since 2008, so I’ve followed a ton of people for various reasons. Lately I have been using Twitter to follow people involved in the Colorado tech community and there’s a LOT of people involved in the Colorado tech community. Since I’m at the ceiling of following 2001 accounts I need a way to manage the accounts that I’m following. I’ve started using lists for different types of accounts. I have an Avalanche list for Avalanche fans, a News list for local breaking news reporters and a Colorado Tech list to keep up with the people I want to follow on Twitter when I can’t just follow them. It’s a messy way to organize since Twitter doesn’t seem to place a lot of importance on lists. So here are my 2 solutions to my problem:
- Stop following dormant accounts – I bet there’s an account I followed 3 years ago who hasn’t said anything in 2 years but the account hasn’t closed. There’s no point in following someone who doesn’t say anything. I will make an app to show me the dormant accounts that I’m following.
- Better manage my lists – I like using lists in Twitter. Sometimes it’s the only thing that tells me why I’m following an account. If I’m following an account and I don’t have that account in a list it either means I’m not interested in that account anymore or it hasn’t said anything. By finding out which accounts are in which lists I can better manage them. I will make an app to show me which accounts are in which lists and whether or not I am following those accounts.
The entire reason I started learning Ruby was because of the Twitter API tutorial on Codecademy which is a pretty damn awesome tutorial. It tells you all about RESTful APIs, http requests and responses before even touching Twitter. These are some super important things to know when using APIs. I’ll be writing a post about those things shortly just for reference.
Anyway I went back to that tutorial, copied some of the code from one of the examples and started squishing code around to find out which accounts I’m following have gone dormant. Version 1 will just be a Ruby command-line app that shows the username and date of last tweet for accounts that haven’t tweeted in over a month. I’m better at making things work than making things easy to use. Here’s where I’m at so far…
- Rate limits are unforgiving. I made a loop that made requests of the Twitter API on each iteration, but forgot to exit the loop. I had to wait 15 minutes to try again.
- Authentication is confusing. Tokens baffle me. I need to get more comfortable with this.
- I’ve hit a wall (which is why I’m blogging right now and not coding). I’m using the GET friends/list functionality of the API. It tells me it returns “pages” of results that can have up to 200 users per page. I’ve learned how to use cursors to retrieve the next “page” but for some reason no matter how many users I request per “page” I only get 45 total users before Ruby gets mad at me for attempting to call a method on a nil object which confuses me.
- I wonder if my weird 45 user limit has to do with my misunderstanding of OAuth.
- Maybe I should try using the GET friends/ids part of the API, but I’m not sold on this idea. I’d rather get the whole friend object instead of just ids.
Now that I’ve typed through my wall, I’m gonna go back to squishing code. If you know what I’m doing wrong, please let me know.