仅从Twitter API获取用户时间轴的选定字段
我从一个iOS应用程序中获取用户的时间线,并从API中获取大量推文。我正在使用仅从Twitter API获取用户时间轴的选定字段,twitter,Twitter,我从一个iOS应用程序中获取用户的时间线,并从API中获取大量推文。我正在使用状态/user_时间线端点来获取数据,但是,由于我在移动设备上,而且我只需要tweet文本,所以我只想过滤tweet的实际文本数据。我已经将include_entities设置为no并将trim_user设置为true,但即使删除了实体和用户数据,我仍然会得到很多不需要的数据。以下是我从端点获得的示例推文: { "created_at": "Tue Nov 27 14:13:13 +0000 2012", "id":
状态/user_时间线
端点来获取数据,但是,由于我在移动设备上,而且我只需要tweet文本,所以我只想过滤tweet的实际文本数据。我已经将include_entities
设置为no
并将trim_user
设置为true
,但即使删除了实体和用户数据,我仍然会得到很多不需要的数据。以下是我从端点获得的示例推文:
{
"created_at": "Tue Nov 27 14:13:13 +0000 2012",
"id": 273429272209801200,
"id_str": "273429272209801217",
"text": "you could list #5ThingsIFindAttractive but you can actually find them on Facebook with Social Match on iPhone! http://t.co/zRr1ggbz",
"source": "web",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"user": {
"id": 62828168,
"id_str": "62828168"
},
"geo": null,
"coordinates": null,
"place": {
"id": "682c5a667856ef42",
"url": "http://api.twitter.com/1/geo/id/682c5a667856ef42.json",
"place_type": "country",
"name": "Turkey",
"full_name": "Turkey",
"country_code": "TR",
"country": "Turkey",
"bounding_box": {
"type": "Polygon",
"coordinates": [
[
[
25.663883,
35.817497
],
[
44.822762,
35.817497
],
[
44.822762,
42.109993
],
[
25.663883,
42.109993
]
]
]
},
"attributes": {}
},
"contributors": null,
"retweet_count": 0,
"favorited": false,
"retweeted": false,
"possibly_sensitive": false
}
我唯一真正需要的是字典的
文本
键。其余部分目前对我的应用程序无效。我会要求很多这样的推特。我怎样才能发送请求到tweets的文本
键?目前,这种方法效率极低。你不能。你能做的最好的事情就是设置一个代理,它将请求数据,将其剥离,然后将其转发给移动设备
如果有什么安慰的话,JSON将是gzip'd,因此应该仍然相对较小-因此不会花费太长时间来传输或占用用户的数据空间。好的,我将gzip数据,这对我来说是最好的。。遗憾的是,没有一个与facebook的graph/fql api相当的api来选择我们只需要的字段。