Using the REST Twitter API in our web-application (Wk 12)
Due to the technical limitations of the Twitter API not allowing us to get tweets from every users from a single day, it was decided to use the alternative method of getting the tweets of a single user, sorting these by date, and repeating this process for several other users (specifically users tweeting about things that happened on a specific date) to compile a set of tweets that still relate to our web application's purpose.
The single-user tweets method relies on the utilisation of a TwitterOAuth library and the example I followed along used a user named a library by user 'Abraham' (accessed and downloaded from GitHub). I first retrieved my Twitter API key and secret from the developers page which were used to identify the specific application. These were defined as variables in index.php:
Next, connection was established using these newly created variables using the Abraham Twitter library. Following this a call is made to get the tweets from a specified user and then display them:
As we can see there are many arguments that are able to be specified when getting a specific users tweets. In this case the user we are retrieving Tweets from is has the screen name (screen_name) 'snowden'. It can also be noted that we are getting a count of 200 tweets, with no replies or retweets (exclude_replies => true, include_rts => false).
It was actually a surprisingly straight forward process to get a stream of Tweets up and running for a specific user - I initially had thought that the changes to the Twitter API had made it rather difficult to do this. The easiness of this process has given our team a suitable alternative to the current Twitter column without having to change it to a news column or something different completely.
EDIT: In the end the team unanimously decided to revert to the original Twitter column which showed trend data for the current date only. It is believed that these global trends suit the website's purpose more than a single users' tweets. Reflecting on this I can definitely see the importance of having more than several users information featured on the Twitter column as the three columns are all about the juxtaposition of past history and current history social media - just a few users cannot effectively summarise/account for an entire generation.
The single-user tweets method relies on the utilisation of a TwitterOAuth library and the example I followed along used a user named a library by user 'Abraham' (accessed and downloaded from GitHub). I first retrieved my Twitter API key and secret from the developers page which were used to identify the specific application. These were defined as variables in index.php:
Next, connection was established using these newly created variables using the Abraham Twitter library. Following this a call is made to get the tweets from a specified user and then display them:
As we can see there are many arguments that are able to be specified when getting a specific users tweets. In this case the user we are retrieving Tweets from is has the screen name (screen_name) 'snowden'. It can also be noted that we are getting a count of 200 tweets, with no replies or retweets (exclude_replies => true, include_rts => false).
It was actually a surprisingly straight forward process to get a stream of Tweets up and running for a specific user - I initially had thought that the changes to the Twitter API had made it rather difficult to do this. The easiness of this process has given our team a suitable alternative to the current Twitter column without having to change it to a news column or something different completely.
EDIT: In the end the team unanimously decided to revert to the original Twitter column which showed trend data for the current date only. It is believed that these global trends suit the website's purpose more than a single users' tweets. Reflecting on this I can definitely see the importance of having more than several users information featured on the Twitter column as the three columns are all about the juxtaposition of past history and current history social media - just a few users cannot effectively summarise/account for an entire generation.


Comments
Post a Comment