Twitter – Find tweets by app

searchtwittertwitter-api

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?

Best Answer

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