当推文被删除时,id 推文出现问题 (Jtwitter)
我的代码是:
for(int i=0;i<listTweetId.size();i++){
if((status = twitter.getStatus(listTweetId.get(i)))!=null){
...
我的问题是 listTweetId 中存在一些 tweetId,它们是删除的推文的 ID,我不知道它如何验证,因为我的 if 不适用于这种情况。最后在这种情况下它会出现错误,如下所示:
Exception in thread "main" winterwell.jtwitter.TwitterException$E404:
Not Found HTTP/1.1 404 Not Found
{"error":"No status found with that ID.","request":"/1/statuses/show/112779914381492224.json?include_entities=1&"}
PS:推文不为空
My code is:
for(int i=0;i<listTweetId.size();i++){
if((status = twitter.getStatus(listTweetId.get(i)))!=null){
...
My problem is that exist some tweetId into listTweetId that are Id of tweets deleted and I don't know how it verify, because my if not works for this case. Finally in this case it spears a error, that is follows :
Exception in thread "main" winterwell.jtwitter.TwitterException$E404:
Not Found HTTP/1.1 404 Not Found
{"error":"No status found with that ID.","request":"/1/statuses/show/112779914381492224.json?include_entities=1&"}
P.S.: Tweets are not empty
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不完全确定您的问题是什么,但如果问题是获取不存在的推文的状态会引发异常,您需要将该部分包装在 try/catch 中以避免退出循环。
I'm not entirely sure what your question is, but if the issue is that getting the status for a non-existent tweet throws an exception, you need to wrap that part in a try/catch to avoid dropping out of the loop.