Posted by Sandro on March 1st, 2009

Open sourced: Tweetr

tweetr

UPDATED: Tweetr has gotten an Update since this blog post. See this blog post for more infos.

While i was developing  Twidget , i started building up a AS3 Library for using the Twitter API, since the only other library i found seemed a bit painful to use.

So after taking some additional time to generate all the needed methods, data objects and inline documentations, i am happy to announce that “Tweetr” is available for public consumption over Googlecode :).

Features:

  • includes practically all twitter api methods
  • includes twitter search api
  • includes a URLShortener Class which utilizes http://is.gd

Since twitter has a very restricted crossdomain policy, at the moment, tweetr can only be used for AIR/Zinc or Launcher Applications since they have ways to circumvent the Crossdomain problem.

I will be working on a simple php wrapper class that i can include with tweetr so you could use it for website integration. If you are interested in Tweetr’s future, there is also a small Roadmap up on the Wiki pages.

Nothing left to say than go and grab it while it’s hot:

http://code.google.com/p/tweetr/

Related Posts
Post a Comment


31 Comments »

  1. Wow! amazing! But i can’t really figure out the API just yet. When are the examples coming?

    I tried making a Tweetr and do a sendTweet but for now it had no results. I’m really excitedabout this!

    comment-bottom
  2. Sandro says:

    Hi Kjelle

    I will be releasing examples as soon as i’m done with the PHP Proxy for Tweetr which will be part of the next release. I expect this to be within this or next week.

    Keep in mind that Tweetr at the moment only works for AIR Applications and/or other similar runtimes like Zinc or Launcher since twitter has a rather strict crossdomain policy.

    Either way, you can try the following example from within Flex or Flash and run it, since the sandbox doesn’t act up within the IDE’s. So, that said, here’s the example on how to use sendTweet:

    //create a new tweetr instance
    var tweetr:Tweetr = new Tweetr();
     
    // add your login credentials
    tweetr.username = "yourUsername";
    tweetr.password = "yourPassword";
     
    // add some event listeners for when a request succeeds or fails
    tweetr.addEventListener(TweetEvent.COMPLETE, handleResult);
    tweetr.addEventListener(TweetEvent.FAILED, handleFail);
     
    // now send your tweet
    tweetr.sendTweet("my test tweet");

    When your request succeeds, the handleResult Method will receive a TweetEvent containing a StatusData within the responseArray.

    That StatusData Object will be equal to the tweet you just made. Which is the exact same behaviour as defined by the actual twitter rest api.

    Hope this helps to get you started.

    comment-bottom
  3. Waauw thanks for the quick answer. I’m gonna try it right now. I was searching for an easy twitter library for my current adobe AIR project. So I’m really happy that I found Tweetr, it seems like the perfect solution to my problem.

    I’m looking forward to seeing this project evolve.

    Thanks man :)

    comment-bottom
  4. Just tested it and it works just fine. Thank you so much! I’m gonna play around with all the other stuff you’ve implemented.

    Thank you !

    comment-bottom
  5. Igor says:

    Hi Sandro,

    Thanks for nice code library. However, can you tell why some POST methods don’t work?

    For example, friendships/destroy method seems don’t work. However, it is seen in your library.

    comment-bottom
  6. Igor says:

    Also, another point:

    I’ve launched your example code posted above in Flash IDE and got following:

    Error opening URL ‘http://xxxxx:yyyyyy@twitter.com/statuses/update.xml’

    Tweets failed!

    Where xxxxx and yyyyy is actual username and password.

    What should I do have your example working?

    Looking forward to your answer!
    Thanks!

    comment-bottom
  7. Igor says:

    Thanks for great library! It works in AIR very well. Thank you!!!

    comment-bottom
  8. Sandro says:

    Hi Igor

    when you use the Libary for a simple Flash IDE Project you might have to upload the compiled swf to a server to actually get it working. Seems that the connection gets blocked through the Flash IDE for most people.

    comment-bottom
  9. SEAN says:

    Hi Sandro

    Awesome work! I have run into a problem and have a feeling that it has to do with server setup. I continuously get the Authentication Required window from the browser whenever I am looking to do something that requires a username and password.

    I am able to populate a datagrid just fine when accessing the public timeline, so I know that the proxy is working OK.

    Any thoughts?

    Thanks in advance,
    Sean

    comment-bottom
  10. Praveen says:

    Hi Sandro,

    Awesome job man. I tried using it in my local machine for a Flex web application. There’s no response returning.

    1. How do i proceed ?

    2. How come your example is working fine on the web ?

    3. Can i use the PHP proxy to make my application work fine with the Tweetr API ? If Yes, kindly guide me.

    Pls reply. Thanks in advance.

    comment-bottom
  11. Nate says:

    Hi,

    I’m using this library for a work project and it works great when I run it from Flex, but as soon as I try to deploy it anywhere I get a flash security error: Error #2156: Port 1 may not be accessed using protocol http.
    at flash.net::URLStream/load()
    at flash.net::URLLoader/load()
    at com.swfjunkie.tweetr::Tweetr/getUserTimeLine() Tweetr.as line 295

    comment-bottom
  12. Nate says:

    Setting browserAuth to false solved the problem. The comments in the source code say that this only needs to be set to false for AIR but apparently that’s not the case.

    comment-bottom
  13. Praveen says:

    Hi Nate,
    Can you shed some light for my problem here.
    Please share the code sample if any.

    http://blog.swfjunkie.com/2009/03/open-sourced-tweetr/#comment-117

    Thanks in advance.

    comment-bottom
  14. Camilo says:

    Hey Sandro,

    First of all I just want to say amazing work! I am learning a lot from it. I got a couple of questions man… I am making a FLEX application that shows the latest tweets depending on a keyword, the idea is that the app updates actumaticall, like updates in runtime.

    So, Im using a Timer, that launches an event every 5000 miliseconds, and every time that event fires I refresh a data grid with the response array returned by the search method of your class. But its not behaving well.. sometimes it updates instantly and anothers not… Ill appreciate any help.

    Thanks in advance

    comment-bottom
  15. Hi Sandro,

    I try to implement simple application using library. I am getting this error.

    Error #2048: Security sandbox violation:

    can you please help me to find out what will be wrong?

    Regards,

    Alpesh

    comment-bottom
  16. Nico says:

    Hey,

    ähm your API is great – no qestion. But since you update it, it doesn’t work with air?

    greets, nico

    comment-bottom
  17. Hey Sandro – thank you for all your hardwork – I’m sure it’s no easy task trying to support this. It’s a cool API.

    I’m having huge troubles with the Proxy script. I can point to your servistHost and run authenticated getUserTimeline, but when I try to use the proxy script on my server, it fails. But the proxy script works on my server if there is no auth required (like on getPublicTimeline() method). Have you updated the proxy php script or has something changed on Twitter’s end?

    comment-bottom
  18. Dan says:

    Exactly what I needed. I have one question though:

    Will there be any Twitter “Nearby” support in the future?
    This would allow a similar feature to Tweetie 2 where you can see people who tweet near you.

    Thanks,
    Dan

    comment-bottom
  19. I’m truly enjoying the design and layout of your site. It’s a very
    easy on the eyes which makes it much more pleasant for me to come here and visit more often.
    Did you hire out a developer to create your theme?
    Superb work!

    comment-bottom
  20. This is very interesting, You are a very skilled blogger. I have
    joined your rss feed and look forward to seeking
    more of your magnificent post. Also, I’ve shared your site in my social
    networks!

    comment-bottom
  21. Il me tarde de lire votrе prochain article

    comment-bottom
  22. Ѵous ոous concoctez toujours des posts fascinants

    comment-bottom
  23. Je vɑis terminer de regarder tout ça apгès

    comment-bottom
  24. C’еst ɗu plaisiг de parcourir ce site internet

    comment-bottom
  25. On peսt vous dire ԛuе ce n’est guère inexact !

    comment-bottom
  26. Isis says:

    Unе fois Ԁе plus un article еffectivement captivant

    comment-bottom
  27. Poste trèѕ fascinant

    comment-bottom
  28. Je ո’ai guère terminé de lire cependant je reviendrai dans la soirée

    comment-bottom
  29. Un extrêmе remerciiement au webmaster du site

    comment-bottom
  30. Vivemeոt un aսtre article

    comment-bottom
  31. On гemarque immédiatement que vous maîtrisez superbement bien ce que vouѕ dites

    comment-bottom

RSS feed for comments on this post | TrackBack URL

Leave a comment

Flash Flex Actionscript Tutorials Tutorial AS2 AS3 AS1 Feeds MXML Blog Zinc AIR Launcher Twitter Tweetr Yet Another Coverflow Liip Adobe Macromedia PHP MySQL PostgreSQL XML AMF MXNA Phidgets Schweiz Switzerland Suisse Svizzera Fribourg Freiburg Aargau Baden Publicis Accessibility JAcc Qt FOSDR Flash on the Beach Forum Conference Speaker Speaking Talk