Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I need to find all tweets made by a defined app.

I discovered the "source" search operator that allows to do that.

For example, here is the URL of the search to find all tweets made with Tweetbot for iOS: https://twitter.com/#!/search/source%3ATweetbot_for_iOS

The problem is I need to get the result as JSON or XML. Here is what is indicated on the Twitter search API documentation

  1. Run your search on twitter.com/search.
  2. Copy the URL. For example: https://twitter.com/#!/search/%40twitterapi
  3. Replace https://twitter.com/#!/search/ with http://search.twitter.com/search.json?q=. For example: http://search.twitter.com/search.json?q=%40twitterapi

It gives us http://search.twitter.com/search.json?q=source%3ATweetbot_for_iOS which returns

error: "Invalid query"

Any idea?

share|improve this question

2 Answers 2

The answer is found on the Twitter search API documentation

source

  • can only be combined with a keyword parameter. If you do not include a keyword you will receive an HTTP 403 error with the message: {"error":"You must enter a query."}.
  • supports multi-word sources by using _ instead of spaces. For example, the source "Tweet Button" should be entered as source: tweet_button

Therefor you must include a keyword. You can't get all the tweets from a source, you can only get all the tweets from the source which including a keyword, for example FBI:

http://search.twitter.com/search.json?q=fbi&source%3ATweetbot_for_iOS

share|improve this answer
    
Thanks for your answer. That explains why I get the error message. However I would really appreciate finding another way to achieve that search. –  Olivier Payen Apr 23 '12 at 12:14

Why you get the error message, @mhoran_psprep explained that. Now if you still want to achieve something like that, the closest thing is to choose a keyword, that is likely to appear in every other tweet and search with that + the source. There is no word like that, so I chose a letter. :P

I searched with the letter a and the source as tweetdeck.

http://search.twitter.com/search.json?q=a%20source:tweetdeck

The search works. The character a is likely to appear in most tweets. You can choose any other letter too. See if this works for you too. :)

share|improve this answer
    
That's a good idea –  Olivier Payen Apr 24 '12 at 7:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.