使用推特搜索 api 获取带有图片的推文

编程入门 行业动态 更新时间:2024-10-24 23:16:29
本文介绍了使用推特搜索 api 获取带有图片的推文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

是否可以获取包含照片的推文?我目前正在使用 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/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/search.json?q=from%3Agoogle%20since%3A2012-01-31%20filter%3Aimages&include_entities=true"

希望这会有所帮助.

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

更多推荐

[db:关键词]

本文发布于:2023-04-29 16:22:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1192085.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图片   api

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!