gpt4 book ai didi

json - Twitter api 不返回截断的文本

转载 作者:行者123 更新时间:2023-12-05 00:29:57 24 4
gpt4 key购买 nike

我正在发出 JSON 请求以获取特定用户的推文,这是我的请求 url https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=booty&count=50我收到了请求的结果,但是有一个问题,如果返回的推文文本很长,那么默认情况下它会被截断我怎样才能得到这个截断的文本?或者我可以禁用此截断吗?这是返回截断结果的示例

        {
geo = "<null>";
id = 848983209580822529;
lang = en;
place = "<null>";
"possibly_sensitive" = 0;
"retweet_count" = 8789;
retweeted = 0;
source = "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>";
text = "It was an honor to welcome President Al Sisi of Egypt to the @WhiteHouse as we renew the historic partnership betwe\U2026 "; // here can see the text is truncated
truncated = 1;
}

result text : 很荣幸地欢迎埃及总统 Al Sisi 来到@WhiteHouse,因为我们更新了我们之间的历史性伙伴关系......

这是原始推文的文本:很荣幸地欢迎埃及总统 Al Sisi 来到@WhiteHouse,因为我们续签了美国和埃及之间的历史性伙伴关系。

最佳答案

经过几个小时的研究,我发现我所需要的只是谷歌搜索的正确关键字,在请求 Url 中添加 tweet_mode=extended 就可以了。

上一个网址:https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=booty&count=50

正确的网址:https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=booty&count=50&tweet_mode=extended

要获取文本,请使用 full_text 而不是 text 键。

此处有更多详细信息 --> https://twittercommunity.com/t/truncated-text-and-media-entities-not-returned/74358

关于json - Twitter api 不返回截断的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43200595/

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