twitter api没有返回截断的文字

时间:2017-04-04 07:11:59

标签: json twitter

我正在制作JSon请求以获取特定用户的推文,这是我的请求网址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;
}

结果文字:It was an honor to welcome President Al Sisi of Egypt to the @WhiteHouse as we renew the historic partnership betwe....

这是原始推文的文字: It was an honor to welcome President Al Sisi of Egypt to the @WhiteHouse as we renew the historic partnership between the U.S. and Egypt.

1 个答案:

答案 0 :(得分:6)

经过数小时的研究后,我发现我需要的只是我谷歌搜索的正确关键字,在请求中添加了tweet_mode=extended Url完成了这项工作。

上一个网址: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密钥。

此处提供更多详细信息 - &gt; https://twittercommunity.com/t/truncated-text-and-media-entities-not-returned/74358