我有一个Twitter机器人,它发布的短文本有时超过了一条推文的字符限制。当它超过限制时,我想让机器人发布作为一个线程组织的几个推文全文。我在他们的API文档中看不到任何关于这样做的文档。对于如何实现这一点有什么想法吗?
我的机器人是用PHP语言编写的,它使用这样的类:https://github.com/J7mbo/twitter-api-php
发布于 2018-09-18 11:32:24
可能不会(永远不会?)每个线程都是可用的:Is there any api update for tweet thread(storm) feature which recently released in twitter?
我在谷歌上对这个话题进行了多次搜索,但没有找到一篇展示如何使用API创建多条tweet线程的文章。在API documentation中类似的搜索没有找到任何结果。我有这么多关于如何利用这样的功能的好主意,这可能就是为什么它不能exist...it也有太多滥用的可能性。
发布于 2019-09-08 23:19:49
您可以使用reply创建线程。下面是关于java https://gist.github.com/ivamluz/6284531#file-twitter4j-post-reply-java的示例。
public static void replyTo(List<Status> tweets) {
Twitter twitter = new TwitterFactory().getInstance();
Status reply = null;
for (Status tweet : tweets) {
try {
reply = twitter.updateStatus(new StatusUpdate(UUID.randomUUID() + " - @" + tweet.getUser().getScreenName() + " this is a reply to your tweet.").inReplyToStatusId(tweet.getId()));
System.out.println("Posted reply " + reply.getId() + " in response to tweet " + reply.getInReplyToStatusId());
} catch (TwitterException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}https://stackoverflow.com/questions/51563995
复制相似问题