проблема с входящими сообщениями на YouTube - PullRequest
2 голосов
/ 16 июня 2011

Я пытаюсь программно (используя gdata api) получить входящие сообщения из учетной записи YouTube.

Мой запрос:

NSURL *url = [NSURL URLWithString:@"http://gdata.youtube.com/feeds/api/users/my_nick/inbox"];

NSMutableURLRequest *inboxRequest = [NSMutableURLRequest requestWithURL:url];

NSString *authStr = [NSString stringWithFormat:@"GoogleLogin auth=%@", authMarker];

[inboxRequest setValue:authStr forHTTPHeaderField:@"Authorization"];
[inboxRequest addValue:@"Content-Type" forHTTPHeaderField:@"application/x-www-form-urlencoded"];
[inboxRequest setHTTPMethod:@"GET"];

NSHTTPURLResponse *response = NULL;

NSData *responseData = [NSURLConnection sendSynchronousRequest:inboxRequest returningResponse:&response error:nil];

NSString *responseDataString = [[NSString alloc] initWithData:responseData encoding:NSASCIIStringEncoding];

NSLog(@"\n%@\n", responseDataString);
NSLog(@"\n%@\n", [inboxRequest ]);

возврат фида без записей ... (хотя я могусмотрите входящие сообщения на сайте)

здесь ответ от nslog: <?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>http://gdata.youtube.com/feeds/api/users/thisistestnick/inbox</id><updated>2011-06-16T14:45:00.475Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#videoMessage'/><title type='text'>Inbox of thisistestnick</title><logo>http://www.youtube.com/img/pic_youtubelogo_123x63.gif</logo><link rel='alternate' type='text/html' href='http://www.youtube.com/my_messages?folder=inbox&amp;filter=videos'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/users/thisistestnick/inbox'/><link rel='http://schemas.google.com/g/2005#batch' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/users/thisistestnick/inbox/batch'/><link rel='self' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/users/thisistestnick/inbox?start-index=1&amp;max-results=25'/><author><name>thisistestnick</name><uri>http://gdata.youtube.com/feeds/api/users/thisistestnick</uri></author><generator version='2.0' uri='http://gdata.youtube.com/'>YouTube data API</generator><openSearch:totalResults>0</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage></feed>

что не так?Пожалуйста, помогите.

1 Ответ

0 голосов
/ 01 июля 2012

Почему вы не можете использовать, gdata -jectivec lib api скорее выполняет ваш собственный анализ?Я не пытался получить «входящие», но довольно успешно получил нужную мне информацию.Преимущества его использования:

a) Вы получаете информацию в нативных форматах (строки и словари), lib выполняет работу по разбору каналов для вас.
b) в основном, разбор не будет /ошибки понимания API (я полагаю, это причина вашей проблемы).

...