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?
相关问题
- Rails how to handle error and exceptions in model
- CORS issue with Twitter api calls in Webpack dev s
- Twitter sign in crashes with TWTRInvalidInitializa
- Accessing Twitter through Javascript
- Swift 3: How to reverse a transparent Navigation B
相关文章
- is there a callback option with twitter's “fol
- Twitter name length in DB
- Twitter oauth refresh token
- Login with Twitter on iOS
- linqtotwitter - grab the saved credentials
- Getting the location using Tweepy
- Making any tweet favourite through iOS 5 twitter A
- LinqToTwitter - IsAuthorized always returns false
With Latest twitter API I couldn't get filters work and I couldn't find either any explanation in their docs. Althought you can get all the tweets and then parse only the media ones. You can fire this if inside your parsing script:
This is not the best solution but the worst part comes to twitter who's giving you more information and using more of its own resources.
There is no specific way to specify that I need only photos or videos but you can filter the results based on
filter:links
orfilter:images
orfilter:videos
in your query along withinclude_entities=true
.For Example: To get the tweets that contain links since
2012-01-31
, you query should haveinclude_entities
parameter as well asfilter:links
as shown as follows: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:
Hope this helps.
In the lastest twitter API you can do it in the ConfigurationBuilder instance, before creating the Twitter instance:
Also, after enabling the entities, in the search string you have to had the condition "filter:images".
And you will get just results with images (tested with twitter4j-core 4.0.4).