Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Tweets with Pictures using twitter search api

Is it possible to get tweets which contain photos? I am currently using twitter search api and getting all the tweets having entity details by setting include_entities=true. I see picture details under media object but is there anyway to filter and get tweets objects which just have these media items. Or is there anyway in Twitter4j to do this query?

like image 343
Hemant P Avatar asked Dec 17 '12 19:12

Hemant P


1 Answers

There is no specific way to specify that I need only photos or videos but you can filter the results based on filter:links or filter:images or filter:videos in your query along with include_entities=true.

For Example: To get the tweets that contain links since 2012-01-31, you query should have include_entities parameter as well as filter:links as shown as follows:

https://search.twitter.com/search.json?q=from%3Agoogle%20since%3A2012-01-31%20filter%3Alinks&include_entities=true"

As your need is to filter your tweets based on images/photos, I think you should use filter:images.

An example of your case would look like:

https://search.twitter.com/search.json?q=from%3Agoogle%20since%3A2012-01-31%20filter%3Aimages&include_entities=true"

Hope this helps.

like image 132
Abhishek Sivasubramanian Avatar answered Oct 24 '22 20:10

Abhishek Sivasubramanian