简体   繁体   English

搜索API上的iOS Twitter实体

[英]iOS Twitter Entities on search API

I'm integrating some Twitter functions on my app. 我在我的应用程序中集成了一些Twitter功能。 So basically what i want to do is to retrieve tweets based on some keywords (#hashtags) and from those extract if present pictures and present them to the user. 因此,基本上我想做的就是根据一些关键字(#hashtags)检索推文,并从那些提取的内容(如果存在图片中)呈现给用户。

The problem is that on "GET Search" query such as "http://search.twitter.com/search.json?q=Twitter%20API&result_type=mixed&count=5" entities are not supported so I'm wondering how can I achieve my task. 问题是,在“ GET Search”查询中,例如"http://search.twitter.com/search.json?q=Twitter%20API&result_type=mixed&count=5"实体不受支持,因此我想知道如何实现我的任务。

I thought to get all the tweets with that query and then for each tweet do this call "GET statuses/show/:id" so i can get the entities for each tweet- get the link in the tweet text - and then make another call to a service where tweet pictures are stored and shared but it seems inefficient, it needs a lot of connection. 我想通过该查询获取所有推文,然后为每个推文执行此调用“获取状态/显示/:id”,这样我就可以为每个推文获取实体-在推文文本中获取链接-然后进行另一个调用到存储和共享鸣叫图片的服务,但效率似乎很低,它需要大量连接。

Just % escape the #. 只是%逃脱了#。 In a URL %23 is a #. 在URL中,%23是#。

This query will look for tweets tagged #iphone. 该查询将查找标记为#iphone的推文。

http://search.twitter.com/search.json?q=%23iphone&result_type=mixed&count=5 http://search.twitter.com/search.json?q=%23iphone&result_type=mixed&count=5

To escape the string do this 要转义字符串,请执行此操作

NSString url = @"url with #hashtag"; NSString url = @“带有##标签的URL”; NSString *escapedString = [url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString * escapedString = [url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

That will replace the # with %23. 它将用%23替换#。

当时Twitter Search API不支持实体,现在可以正常使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM