从 YouTube 视频获取评论 - GData Objective-c

发布于 2025-01-06 14:45:46 字数 88 浏览 3 评论 0原文

我正在开发一个需要使用 YouTube 的 iPhone 应用程序。我想知道如何从视频中获取评论?我环顾四周,但没有运气......很抱歉,如果这个问题有点开放式

I am developing an iPhone application that requires use of YouTube..I wanted to know how can I get comments from a video? I have looked around but have had no luck...sorry if this question is a bit open ended

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

爱冒险 2025-01-13 14:45:46

您应该检查 YouTube API。在此 API 中,可以使用视频评论 Feed

You should check YouTube API. In this API Video comments feed is available.

陌生 2025-01-13 14:45:46
GDataEntryYouTubeVideo * video = {your video entry here};

GDataServiceGoogleYouTube * youtubeService = [[GDataServiceGoogleYouTube alloc] init];

youtubeService.userAgent = @"App Name";
youtubeService.youTubeDeveloperKey = @"your developer key";

GDataQueryYouTube * query = [[GDataQueryYouTube alloc] init];

query.startIndex = 1;
query.maxResults = 50;
query.feedURL = video.comment.feedLink.URL;

[youtubeService fetchFeedWithQuery:query
                      completionHandler:^(GDataServiceTicket *ticket, GDataFeedBase *feed, NSError *error)
{
    if(error)
    {
        return;
    }

    GDataFeedYouTubeComment * commentFeed = (GDataFeedYouTubeComment*)feed;

    NSArray * comments = feed.entries;
}];
GDataEntryYouTubeVideo * video = {your video entry here};

GDataServiceGoogleYouTube * youtubeService = [[GDataServiceGoogleYouTube alloc] init];

youtubeService.userAgent = @"App Name";
youtubeService.youTubeDeveloperKey = @"your developer key";

GDataQueryYouTube * query = [[GDataQueryYouTube alloc] init];

query.startIndex = 1;
query.maxResults = 50;
query.feedURL = video.comment.feedLink.URL;

[youtubeService fetchFeedWithQuery:query
                      completionHandler:^(GDataServiceTicket *ticket, GDataFeedBase *feed, NSError *error)
{
    if(error)
    {
        return;
    }

    GDataFeedYouTubeComment * commentFeed = (GDataFeedYouTubeComment*)feed;

    NSArray * comments = feed.entries;
}];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文