简体   繁体   中英

iOS Twitter Entities on search API

I'm integrating some Twitter functions on my app. 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.

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.

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.

Just % escape the #. In a URL %23 is a #.

This query will look for tweets tagged #iphone.

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 *escapedString = [url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

That will replace the # with %23.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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