gpt4 book ai didi

java - 为什么我在没有超出限制的情况下会收到异常?

转载 作者:太空宇宙 更新时间:2023-11-04 06:58:11 26 4
gpt4 key购买 nike

只转发了 15 条推文,我收到一条异常(exception)消息。

403:The request is understood, but it has been refused. An accompanying error
message will explain why. This code is used when requests are being denied due
to update limits (https://support.twitter.com/articles/15364-about-twitter-limits
-update-api-dm-and-following).

message - Not authorized to use this endpoint.
code - 37

Relevant discussions can be found on the Internet at:
http://www.google.co.jp/search?q=b029ad3d or
http://www.google.co.jp/search?q=132d0e3b
TwitterException{exceptionCode=[b029ad3d-132d0e3b], statusCode=403, message=Not authorized to use this endpoint., code=37, retryAfter=-1, rateLimitStatus=null, version=3.0.6-SNAPSHOT(build: afd755d42f0c2fd7a2a87cedf1e91e123de2d754)}
at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:162)
at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:61)
at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:98)
at twitter4j.TwitterImpl.post(TwitterImpl.java:2023)
at twitter4j.TwitterImpl.retweetStatus(TwitterImpl.java:283)
at org.tester.TweetSearcher.processRequest(TweetSearcher.java:73)
at org.tester.TweetSearcher.doGet(TweetSearcher.java:100)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

 这可能是什么原因?该限制实际上是如何运作的?

转发推文的 Java 代码:

            do {
QueryResult result = twitter.search(new Query("#naples "));
List<Status> statusList = result.getTweets();
while(i.hasNext()) {
Status s = (Status) i.next();
long id = s.getId();
c = new Counter();
int totalUpdates = c.getUpdateCount();

if(totalUpdates <= 30) { // continue to retweet
if(!s.isRetweeted() && !s.isRetweetedByMe()) {
twitter.retweetStatus(id);
totalUpdates++;
c.setUpdateCount(totalUpdates);
}
} else { // Daily Limit Reached
limitReached = true;
}
}
} while(!limitReached);

最佳答案

你一定要看看这个Automation rules and best practices页。

Automated retweeting of other users

We discourage the automatic retweeting of other users based on a particular keyword and may suspend accounts that engage in this behavior, particularly if they are being frequently blocked and reported as spam.

顺便说一句,我想你必须提供一些像 sleep() 这样的函数来延迟每次转发。

关于java - 为什么我在没有超出限制的情况下会收到异常?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22446492/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com