如何从我的搜索查询结果选项中排除转发 [英] How to exclude retweets from my search query results Options

查看:144
本文介绍了如何从我的搜索查询结果选项中排除转发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用twitter4j中的搜索方法搜索推文。我的代码如下

I'm trying to search tweets using search method in twitter4j. My code is as follows,

    public List<Tweet> searchTweets(Query searchQuery) { 
        QueryResult queryResult = twitter.search(searchQuery); 

        return queryResult != null ? queryResult.getTweets() : new 
             ArrayList<Tweet>(0); 
    } 

如何从搜索查询结果中排除转推

How do I exclude retweets from my search query results

推荐答案

我宁愿对此发表评论,但我还不能这样,我会将此作为答案发布。您需要通过向其添加参数来编辑查询。可以在twitter4j文件夹的examples文件夹中找到Query.java的源代码。

I would rather comment on this but I can't yet so I'll post this as an answer. You need to edit the Query by appending parameters to it. The source code for Query.java can be found in the examples folder in the twitter4j folder.

public Query(String query) {
    this.query = query;
}

查看 Twitter搜索(原子)API - 排除转发。搜索基础不同,但概念是相同的,即追加+排除:转发到字符串查询的末尾。尝试一下,如果有效,请告诉我!

Check out Twitter search (atom) API - exclude retweets. The search basis is different but the concept is the same, which is appending +exclude:retweets to the end of your string query. Try it out and do let me know if it works!

这篇关于如何从我的搜索查询结果选项中排除转发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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