gpt4 book ai didi

ios - 用户时间线的 Twitter JSON URL

转载 作者:行者123 更新时间:2023-11-29 04:03:16 25 4
gpt4 key购买 nike

我有一个简单的问题,在我的 iOS 应用程序中我有 twitter 搜索 api。我希望实现对主题标签和用户时间线的搜索。对于主题标签,我有网址:http://search.twitter.com/search.json?q=%23HASHTAGHERE但我无法找到用户时间线的 JSON url。如果有人能指出我这一点那就太好了。谢谢您

目前 HASTAG:

NSString *urlString = [NSString stringWithFormat:@"http://search.twitter.com/search.json?q=&ands=%@&phrase=&rpp=50",searchTerm];
NSURL *url = [NSURL URLWithString:urlString]; //Setup and start async download

NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];

最佳答案

用户时间线的 URL:https://api.twitter.com/1.1/statuses/user_timeline.json

来源:https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline

请注意,这适用于 iOS 5+,因为它使用 TWRequest

    NSURL *getTimeline = [NSURL URLWithString:@"https://api.twitter.com/1.1/statuses/user_timeline.json"];

NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:
<twitter screen name goes here>, @"screen_name",
nil];

TWRequest *twitterRequest = [[TWRequest alloc] initWithURL:getTimeline
parameters:parameters
requestMethod:TWRequestMethodGET];

//Set a twitter account (Gotten from iOS 5+)
[twitterRequest setAccount:self.twitterAccount];

[twitterRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error)
{
if (!error)
{
JSONDecoder *decoder = [[JSONDecoder alloc] initWithParseOptions:JKParseOptionNone];
NSArray *twitterTimeline = [decoder objectWithData:responseData];

}
else
{
//Deal with error
}


}];

如果你只想要一个没有任何身份验证等的 JSON 时间线,那么你可以使用: http://api.twitter.com/1/statuses/user_timeline.json?screen_name=(screen-name-here)

关于ios - 用户时间线的 Twitter JSON URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15601676/

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