使用推特搜索 api 获取带有图片的推文 [英] Get Tweets with Pictures using twitter search api

查看:172
本文介绍了使用推特搜索 api 获取带有图片的推文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以获取包含照片的推文?我目前正在使用 twitter 搜索 api 并获取所有具有通过设置 include_entities=true 来获取实体详细信息.我在媒体对象下看到图片详细信息,但无论如何过滤和获取只有这些媒体项目的推文对象.或者 Twitter4j 中是否有执行此查询的方法?

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?

推荐答案

没有具体的方式指定我只需要照片或视频,但您可以根据 filter:linksfilter:imagesfilter:videos 以及 include_entities=true.

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.

例如:要获取自 2012-01-31 起包含链接的推文,您的查询应具有 include_entities 参数以及 filter:links如下图:

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"

由于您需要根据图片/照片过滤推文,我认为您应该使用 filter:images.

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

您的案例示例如下:

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

希望这会有所帮助.

这篇关于使用推特搜索 api 获取带有图片的推文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆