특정 트위터 계정의 모든 트윗을 가져오고 싶습니다. 나는 아래 URL을 사용하고 싶지만 우리가 가져오고 싶은 tweet의 twitter 계정의 user_id 나 screen_name을 어떻게 얻을 수 있는지 모른다.특정 트위터 계정의 모든 트윗을 가져 오는 중입니까?
리소스 URL http://api.twitter.com/1/statuses/user_timeline.format 매개 변수 사용자 타임 라인을 요청할 때 항상 user_id 또는 screen_name을 지정하십시오.
아무도 아이디어 나 소스 코드 또는 참조를 갖고 있지 않습니까? 어떤 도움이라도 매우 중요합니다.
나는 200 개 트윗을 얻기를 위해 다음과 같은 기능을 사용하고 있지만 NSLog에서
HTTP 응답 상태를 보여줍니다 403 메시지
기능
- (IBAction)followOnTwitter:(id)sender
{
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[accountStore requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error) {
if(granted) {
// Get the list of Twitter accounts.
NSArray *accountsArray = [accountStore accountsWithAccountType:accountType];
// For the sake of brevity, we'll assume there is only one Twitter account present.
// You would ideally ask the user which account they want to tweet from, if there is more than one Twitter account present.
if ([accountsArray count] > 0) {
// Grab the initial Twitter account to tweet from.
ACAccount *twitterAccount = [accountsArray objectAtIndex:0];
NSMutableDictionary *tempDict = [[NSMutableDictionary alloc] init];
[tempDict setValue:@"rohit40793982" forKey:@"screen_name"];
//[tempDict setValue:@"true" forKey:@"follow"];
// [tempDict setValue:@"683286" forKey:@"user_id "];
TWRequest *postRequest = [[TWRequest alloc] initWithURL:[NSURL URLWithString:@"http://api.twitter.com/1/statuses/user_timeline.format"]
parameters:tempDict
requestMethod:TWRequestMethodPOST];
[postRequest setAccount:twitterAccount];
[postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
NSLog(@"%@",urlResponse);
tweets = [NSJSONSerialization JSONObjectWithData:responseData
options:kNilOptions
error:&error];
NSString *output = [NSString stringWithFormat:@"HTTP response status: %i", [urlResponse statusCode]];
NSLog(@"%@", output);
[self performSelectorOnMainThread:@selector(displayText:) withObject:output waitUntilDone:NO];
}];
}
}
}];
}
I가 수신되지 않는 배열을 모든 트윗.
사용할 수 있습니다. –
최근 트위터 변경으로 인해 json 만 현재 사용할 수있는 형식입니다. https://dev.twitter.com/docs/api/1.1/overview#New_Twitter_client_policies – alairock