我已经弄明白了如何发送推文以及如何返回用户首页时间轴。 要返回时间线,只需执行以下操作: -
timeline = t4j.getHomeTimeline();
(其中t4j是twitter4j java对象)
然而,为了使其自动化(即每隔5分钟调用一次时间线),我需要将最后一个推特ID传递给getHomeTimeline。
在twitter4j JAVA示例中有以下java: -
Paging paging = new Paging(2, 40);
List statuses = twitter.getHomeTimeline(paging);
所以我试过了: -
timeline = t4j.getHomeTimeline(sid); throws a method not found or overloaded error
timeline = t4j.getHomeTimeline(1, sid); throws a method not found or overloaded error
sid = JavaCast("long", session.homeTimeline_sid);
timeline = t4j.getHomeTimeline(sid); throws a method not found or overloaded error
timeline = t4j.getHomeTimeline().Paging('sinceID',sid); Again an error
有没有人知道这个???
的正确语法答案 0 :(得分:1)
我想出了语法: -
sid = JavaCast("long", session.homeTimeline_sid);
tPaging = createObject("java", "twitter4j.Paging");
tPaging.setSinceId(sid);
timeline = t4j.getHomeTimeline(tPaging);