My first twitter and oAuth App : TweetXPander
So i am really excited about because as you can see from the heading , its my first twitter and oAuth application.
Back Story :
A few days ago a friend of mine FlintZA through up a challenge on twitter for anyone to come up with a web app that would scrape your twitter friend feed and retrieve any tweets that had a URL in it. Once you had filtered all the tweets the next part was to generate thumbnails for all of the url that the user had posted. Once all that was done the generated and scraped data needed to be outputted as a RSS feed.
The Project : TweetXPander
Since all the components in that i used to build the project are open source i decided to hook up a little tutorial about how i did everything and to share the code with you.
Components Used
Twitter Integration : Twitteroo API , it should be noted that i had to hack this project to allow for oAuth as the downloadable version does not support it and the blog does not give any indication whether they intend to or not.
RSS Integration : I used the RSS.Net Lib , i have used this lib before which is the only reason i chose it , also no modifications were made to it.
Thumbnail Image Generation : Doing this manually via code was a process that turned out to be way to slow , in the end i opted to use ShrinkTheWeb who offer a brilliant service compared to what is available.
I am not going to go into detail here explaining how i did what i did as most of the code flows easily enough and you should not really get confused. If you do need help leave a comment here and i will gladly help.
General Flow :
- On Page load check if the user has been authenticated via twitter yet , if not then send him to the twitter auth page so that we can get access.
- Once he has access start the RSS generation process .
RSS Generation Flow :
- Create a RSS Chanel which we will use later , a RSS channel is what all RSS items are loaded into before they can be outputted to the user.
- Create a instance of the Twitteroo class (this is the oAuth version) and then get the current users friends time line details. This details are then stored in a Users List ( Custom Twitteroo Class).
- I then loop through the list of user tweets and check the Status message. If the message contains a http url I then do more processing on it.
- If the status does contain a URL i then extract the URL from the status. Once it is extracted i then check if it has been shrunk and if so i expand it.
- Once that is done i build a Message that will be added to the RSS item.
- Once the Message has been built it is then added to a RSS item which is added to the original channel we created in the start.
- After the loop has been completed the channel is finally added to a newly created RSS Feed.
- This feed is then outputted to the User Response.
- The user now sees a RSS feed as normal.
That is the basic flow and structure of what i did , i should note that it is quite simplified and i did not really go too deep and make classes for alot of things since this was just a proof of concept.
As always any comments and suggestions on how i can make it better is much appreciated.
Thanks go out to Flint for the great idea and awesome name.
~stalkerh

