简体   繁体   English

Twitter4j太久发布推文

[英]Twitter4j Getting Tweets Too Long

Hello i have tweet id's and i saved them to database before. 您好,我有推特ID,我之前将它们保存到数据库中。 But i saw that i could not save created time efficiently (it is saved like 00:00:00). 但是我看到我无法有效地保存创建的时间(它被保存为00:00:00)。 Therefore i wished to update my tweets with tweet id by using following code. 因此,我希望使用以下代码用推特ID更新我的推特。

   MyConnectionBuilder myConnection = new MyConnectionBuilder();
   Twitter twitter = new TwitterFactory(myConnection.configuration.build()).getInstance();
    Status status = twitter.showStatus(Long.parseLong(tweetId));

But it takes too much time to get tweets, is there any rate limit for this ? 但是获取推文需要太多时间,对此是否有速率限制? If there is a rate limit how can i make it faster ? 如果有速率限制,我如何使其更快?

Updating every single tweet via showStatus wastes your "credits" for a given timeframe (rate-limit). 通过showStatus更新每条推文showStatus浪费给定时间范围(限速)的“积分”。

For updating multiple tweets, you should use lookup with a maximum of 100 ids per request. 更新多个微博,你应该使用lookup最多的100每个请求ID。 This call will use the /statuses/lookup endpoint. 该调用将使用/statuses/lookup端点。

Rate-Limit and endpoint documentation can be found here 速率限制和端点文档可在此处找到

Code-Snipped for it: 代码已截取:

Twitter twitter =  twitterFactory.getInstance();
ResponseList<Status> responseList  = twitter.lookup(ArrayUtils.toPrimitive(ids));

    if(responseList != null) {
        for (Status status : responseList) {
            // do what you need to do here

        }
    }       

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM