#3 Play with the Twitter Search API and JSONP

Since Twitter clients seems to be kind of HelloWorld2.0, this episode will show you how to use JSONP and connect to the Twitter Search API.

For this episode, I’ve decided to copy/paste some chunks of code instead of typing them, to quickly go straight to the point. Please give me your feedback about the copy/paste thing.

Some useful links :

8 Comments

  1. steve says:

    Thanks for another informative cast.

    About the copy pasting, it was fine. imo i would suggest even more copy/pasting thus allowing you more time to explain things, eg you could have copy pasted the label string you built of the tweet and saved some seconds to then not rush through the previous copy/paste bits.

    but still, no complaints, very useful, as the others!

    thanks alot!

  2. The copy and paste idea is great. It means getting to the good bits quicker! :P

    Thanks!

  3. Nabil says:

    I’m finding these tutorials really helpful and I thought the copy/paste idea was good so that you only spend time on the new/difficult bits.

    thanks again Thomas!

  4. Boris says:

    Thanks for the great tutorial, Thomas! I have a couple of questions:

    1. In connection:didReceiveData: you seem to be getting a CPString’s data.results. I suppose CPString should really be a CPObject, and this works because CPString derives from CPObject. Is that correct?

    2. The declaration for connection:didFailWithError: seems to be missing a colon after connection. Is this alternative syntax reliable to use?

  5. Thomas says:

    @steve, @Miles Tinsley, @Nabil, @Boris : Thanks a lot for your feedback! Appreciated!

    @Boris :

    1. CPString indeed derives from CPObject. CPObject is the root class for most Cappuccino classes. What I can read here (http://cappuccino.org/discuss/2008/10/08/xmlhttprequest-jsonp-cappuccino/) is that it should be a CPString. It seems logic to me because the HTTP response is a string.

    2. This is an error, I’ve corrected it here : http://github.com/suitmymind/cappuccinocasts-episodes/commit/80ddb53c73462312bde3038fd8341a04c46b0f12 . Thanks for noticing this!

  6. [...] Por este post é só! Convido todos a aprenderem sobre este Framework, bons estudos, e não deixem de me mandar qualquer coisa que criem utilizando ele. Eu criei uma busca simples no Twitter, usando JSONP e Cappuccino, baseada num Screencast do CappuccinoCasts que vocês podem assistir aqui. [...]

  7. Alex says:

    Thanks for this cast! It’s a great intro and opens the door on many possibilities of new apps based on this one. I just found one little mistake (hopefully I’m not repeating what someone else said) but on line 58-61 of AppController.j:

    var userInput = prompt(“Enter a search keyword”);
    if (prompt) { // …

    should probably be:

    var userInput = prompt(“Enter a search keyword”);
    if (userInput) { // …

    Just thought I’d point it out! Otherwise if you open the input box and press cancel, it’ll search for quotes (I think)