Streaming API with Filter function both location and track


#1

Hi there,

I’m trying on filter the streaming with location and track that I believe it would b combined with OR condition (refer: Streaming Document)
, but it seems filtering only one key base on ordering. Could anyone explain or suggest to me?

Thank you in advance

Ex:
streaming.filter(follow=None,locations=[97.345619, 5.610000, 105.639381, 20.463181],track=‘RT’, async=False, count=None)


#2

Have you tried this with other query terms? “RT” isn’t going to be a great one for you to use with the locations filter, since retweets are not geotagged. Perhaps you’re just not seeing many results that match that text in the locations you’ve provided?


#3

I know the retweets have no any geo-tag but I still wanna feed all tweets that created in this location, include the retweets, so that I tried to get all retweets 'n filter myself in back-end.

It would be fine if I could keep both things as filtering with track and follow… not sure why it has different behavior even you said follow, track and location is OR condition.

Thank you to reply me


#4

I seem to have stumbled into the same problem, being that you can’t OR together the :track, :follow or :location parameters on the single 1.1/statuses/filter.json call.

It seems to just fallback to track if specified, disregarding the other two params.

My use case is creating a stream given a list of user_ids (:follow) and a list of interesting keywords (:track).

Is this what was intended by the API?
If so could you maybe update the docs to say it’s an XOR relationship between the three parameters?


#5

I don’t see the problem. When I call statuses/filter with ‘track’ and ‘locations’ I see the results for ‘track’ and the results for ‘locations’ being ORed. Here’s the call:

https://stream.twitter.com/1.1/statuses/filter.json?track=warm&locations=-74%2C40%2C-73%2C41


#6

Try adding a single user_id onto your params: track=warm&locations=-74%2C40%2C-73%2C41&follow=xxxxxxxxx

It doesn’t filter for that single user, instead it appears to disregard it and just opens the firehose for filtered by the other two parameters.


#7

Hmmm…seems to work for me.

I did three tests using track, locations and follow in all three tests. For each test I posted a tweet that I new would match only one of the three parameters. In the first test only the tracking word match. In second test only the location matched. In the third test only the follow user id matched. In each test I was able to see my tweet. So, it looks like the OR does work.


#8

i have the same problem. I would like to get tweets based on location and track words such that, get the tweets from a certain location which includes the track words.( Location AND track terms). can someone suggest me a way. If you have figured it.


#9

me too. I’m making data visualisations of the global origin of tweets on a given topic over a period of time, using the Twitter streaming API, node.js, socket.io and Google Maps. It works, but seems a great waste of bandwidth, as my options are:

  1. get all tweets with a global location range, then filter the text content on my search term.
  2. get all tweets for the term (track), then filter out those with a location.

In both cases, the vast majority are discarded, and amount to a huge amount of data being streamed.

so I’d love to be able to give location and track, and only get tweets that match both. this seems a better option to me than the current behaviour. does anyone know if there are plans to change this?


#10

@spacebaboon Did you get the solution?


#11

@Apoorv57, the solution that spacebaboon has implemented is the right solution. There are no plans to add an AND operator at this time.

Will close thread as it has deviated from the original post and is almost 2 years old.


#12