我在哪里指定我想在 twitter hbc 中关注的用户

Where do I specify the user I want to follow in twitter hbc

嘿,我希望我关注的某些用户的最新推文显示在我的网络应用程序的页面上。所以我遵循了 git of horsebird client 上的教程,但我不知道我必须在哪里指定我想要消息来自的用户。

public class TwitterLatestTweets implements Runnable {
    private final static String BUNDLE_BASENAME = "configuration.twitter";
    private final static String CONSUMER_KEY = ResourceBundle.getBundle(
            BUNDLE_BASENAME).getString("consumerKey");
    private final static String CONSUMER_SECRET = ResourceBundle.getBundle(
            BUNDLE_BASENAME).getString("consumerSecret");
    private final static String TOKEN = ResourceBundle.getBundle(
            BUNDLE_BASENAME).getString("token");
    private final static String SECRET = ResourceBundle.getBundle(
            BUNDLE_BASENAME).getString("secret");
    private List<String> msgList = new ArrayList<String>();

    @Override
    public void run() {
        /**
         * Set up your blocking queues: Be sure to size these properly based on
         * expected TPS of your stream
         */
        BlockingQueue<String> msgQueue = new LinkedBlockingQueue<String>(100000);
        BlockingQueue<Event> eventQueue = new LinkedBlockingQueue<Event>(1000);

        /**
         * Declare the host you want to connect to, the endpoint, and
         * authentication (basic auth or oauth)
         */
        Hosts hosebirdHosts = new HttpHosts(Constants.STREAM_HOST);

        StatusesFilterEndpoint hosebirdEndpoint = new StatusesFilterEndpoint();

        Authentication hosebirdAuth = new OAuth1(CONSUMER_KEY, CONSUMER_SECRET,
                TOKEN, SECRET);

        ClientBuilder builder = new ClientBuilder().hosts(hosebirdHosts)
                .authentication(hosebirdAuth).endpoint(hosebirdEndpoint)
                .processor(new StringDelimitedProcessor(msgQueue))
                .eventMessageQueue(eventQueue);

        Client hosebirdClient = builder.build();
        hosebirdClient.connect();
        while (!hosebirdClient.isDone()) {
            try {
                String msg = msgQueue.take();
                msgList.add(msg);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            hosebirdClient.stop();

            for (String s : msgList) {
                System.out.println(s);
            }
        }
    }
}

是Constants.STREAM_HOST吗?你能给我一个白宫推特 (https://twitter.com/whitehouse) 的例子吗?

您需要将用户 ID 列表添加到端点,如下所示:

hosebirdEndpoint.followings(userIds);

您有几个示例 here, in the same github project you've provided in your question. This one 使用与您 post 中相同的端点。

here 中,您可以找到关于端点的 Twitter 文档,以及您可以使用的参数的完整列表。