Is it possible to track keyword from the user's timeline?


#1

I found an example code that can receive the PUBLIC API and filter by keywords, Here is partial:

HttpGet request = new HttpGet();
		request.setURI(new URI("https://stream.twitter.com/1/statuses/filter.json?track=" + mSearchTerm));
		consumer.sign(request);
		HttpResponse response = client.execute(request);
		InputStream in = response.getEntity().getContent();
		BufferedReader reader = new BufferedReader( new InputStreamReader(in) );

But now I want this filtering function only provide tweets from user’s home timeline.

I read the official materials, it seems that “track” and getting the home timeline can be done separately, just not together.

Any way I can pass around this? Any tips to point me to the right direction are much appreciated.


#2

This looks like old code since it references version 1 of the API and version 1.1 has been in production for several years. As such, I would not expect it to work.

Track / filter is done on the Streaming API. To get a home timeline you’d want to use the REST API on GET statuses/home_timeline for the logged-in user. There’s no filtering available in the API for that call, you would need to perform it yourself in code.