gpt4 book ai didi

ios - Twitter api 文本字段值被截断

转载 作者:IT老高 更新时间:2023-10-28 12:47:39 29 4
gpt4 key购买 nike

为什么文本字段值被截断以及如何获得完整值。截至目前,我正在尝试获取如下文本字段值

do {
if let responseObject = try NSJSONSerialization.JSONObjectWithData(response, options: []) as? [String:AnyObject],
arrayStatuses = responseObject["statuses"] as? [[String:AnyObject]] {
let arrTweets:NSMutableArray = NSMutableArray()
for status in arrayStatuses {
let text = status["text"]!
print(status["text"]!)
}
}
}

输出是

RT @WarfareWW:#Russia/#India 可能会在今年年底从 Su-30MKI 与 sea/grnd trgts 发射 BrahMos 巡航导弹 https://...

行尾的三个点。我需要打印完整的文本而不被截断。

Twitter 示例搜索结果 JSON 数据

{
"created_at": "Mon Aug 01 08:07:43 +0000 2016",
"id": 760024194079916032,
"id_str": "760024194079916032",
"text": "RT @khalidasopore: #KEXIT #KASHEXIT #KashmirKillings #Inida #Pakistan Just trend it my dear Indians to save #Kashmir from Pak Goons https:/…",
"truncated": false
}

最佳答案

Twitter API 最近已更改,以支持有关 280 个字符限制的新规则。

  1. 要获取推文的全文,请将值为 extended 的参数 tweet_mode 添加到您的请求参数中。
  2. JSON 响应中的
  3. text 字段已替换为 full_text

更多信息在这里:https://dev.twitter.com/overview/api/upcoming-changes-to-tweets

关于ios - Twitter api 文本字段值被截断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38717816/

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