YouTubeや毎日の動きのように、クエリに対してビデオを検索するためにvimeo Advance APIを使用しています。vimeo アドバンス API には oauth 認証が必要です。vimeo が vimeo の遊び場のような json を返すようにします。https://developer.vimeo.com/apis/advanced/methods/vimeo.videos.search/playground . 私はjsonデータを取得するために次のコードを書きますが、jsonデータを取得する人がわかりません
- (void)viewDidLoad
{
[super viewDidLoad];
SBJsonParser *json = [[SBJsonParser alloc]init];
// Do any additional setup after loading the view, typically from a nib.
OAConsumer *consumer = [[OAConsumer alloc] initWithKey:@"0c5e6dd9b8fa5f8d91563332da03912ac8c2e15d"
secret:@"744eb15d911ee3607f7006f1f4ad7eb17a94eec6"];
NSURL *url = [NSURL URLWithString:@"https://vimeo.com/oauth/request_token"];
OAMutableURLRequest *request = [[OAMutableURLRequest alloc] initWithURL:url
consumer:consumer
token:nil
realm:nil
signatureProvider:nil];
[request setParameters: [NSArray arrayWithObjects: [[OARequestParameter alloc] initWithName: @"oauth_callback" value: @"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.search&qdfduery=amir+khan"] ,nil]];
[request setHTTPMethod:@"GET"];
OADataFetcher *fetcher = [[OADataFetcher alloc] init];
[fetcher fetchDataWithRequest:request
delegate:self
didFinishSelector:@selector(requestTokenTicket:didFinishWithData:)
didFailSelector:nil];
}
- (void)requestTokenTicket:(OAServiceTicket *)ticket didFinishWithData:(NSData *)data {
if (ticket.didSucceed)
{
NSString *responseBody = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
OAToken *requestToken = [[OAToken alloc] initWithHTTPResponseBody:responseBody];
NSLog(@"data %@",requestToken);
OAMutableURLRequest *request;
if (self.accessToken != nil) {
self.accessToken = nil;
}
self.accessToken = [[OAToken alloc] initWithHTTPResponseBody:responseBody];
NSLog(@"access token key %@",self.accessToken.key) ;
NSLog(@"access token secret %@",self.accessToken.secret) ;
NSURL *url = [NSURL URLWithString:@"https://vimeo.com/oauth/authorize"];
OAConsumer *consumer = [[OAConsumer alloc] initWithKey:self.accessToken.key
secret:self.accessToken.secret];
request = [[OAMutableURLRequest alloc] initWithURL:url
consumer:consumer
token:self.accessToken
realm:nil
signatureProvider:nil];
OARequestParameter *p0 = [[OARequestParameter alloc] initWithName:@"oauth_token" value:self.accessToken.key];
NSArray *params = [NSArray arrayWithObject:p0];
[request setParameters:params];
[webView loadRequest:request];
NSLog(@"request %@",request);
}
}
上記のコードはアクセス トークンを返します。しかし、そのアクセス トークンを使用して、vimeo プレイグラウンドのように json を取得する方法がわかりません。親切に誰かが私のためにそれを完成させてください.vimeoサイトでは適切なガイドラインがないため、私はとても混乱しています