HW3: GrabATweet
With this assignment I aimed for simplicity to reduce the number of possible issues I could run into. I decided to uses Twitter’s RESTAPI to do a simple pull of a single status. To “spice” things up, so to speak, I decided to make the tweet random and allow the user to grab as many random tweets as they like.
One of the issues I ran into was with the random selection. My random number generator would often generate a number much larger than the current tweet count, so it wouldn’t return anything when processed. I limited the range to ints below 100000 to get around this, though future revisions could feature better accuracy on number of tweets, however there are still instances where the tweet either doesn’t exist or has its viewing locked by the tweeter. In those scenarios, an error message is displayed. I also had difficulty trying to pull the username out of the json object, and due to the other issues I was having, simply dropped it.
If I were to revise this in the future, I would look into making a more fully featured twitter app, or at the very least, increase the ways in which you can consume a random tweet (ie. do a search for a phrase or hashtag and it randomly selects a tweet containing those).