Google is committed to advancing racial equity for Black communities. See how.

Comment changes in the legacy YouTube Data API v2

Jeremy Walker, YouTube API Team
September 2013 (updated 12/02/2013)

Introduction

The new YouTube commenting system, which was launched in November 2013 and is powered by Google+, enables YouTube users to retrieve many more comments per video than they could in the past. The new system makes it easier to find meaningful conversations as well, because comments are ordered by relevance to individual users.

While the new comments aren’t currently supported in the YouTube Data API v3, you can continue to use the older version of the API (v2) with a few caveats outlined below (and the benefits covered above).

We recommend that you confirm that your integration continues to work now that we have switched to the new commenting system and alert us if you encounter any bugs (file issues at youtube.com/dev). Thanks!

Frequently Asked Questions

What happened to comments posted before the transition?

Comments posted before the transition have been migrated to the new system powered by Google+.

Is the comments feed still available?

Yes, for instance, if you use the API to retrieve the comments for a video, you get a feed of comments ordered by relevance as called out in the announcement.* Since the switch to the new commenting system, comments are no longer in chronological order by default. However, you can still order comments chronologically by setting the orderby parameter's value to published in your API request as shown in the following example:

https://gdata.youtube.com/feeds/api/videos/VIDEO_ID/comments?orderby=published

We recommend you follow the standard best practice of using the next and previous links in the comments feed to page through comments. By doing so, you will also get the added benefit of being able to page through many more comments than you were able to before.

If you explicitly set a value for start-index to page through the comments feed (not recommended), it may cause inconsistent behavior and you will only get a small number of comments returned.

Update (11/10/2013):

* By default, comment feeds are sorted by general relevance, not personal relevance. In other words, an authenticated and an unauthenticated comment feed request will return the same results. The API does support a personalized comment feed that includes non-public posts. To get this feed, simply make an authenticated request and set the relevant-to-me parameter's value to true in your API request as shown in the following example:

https://gdata.youtube.com/feeds/api/videos/VIDEO_ID/comments?relevant-to-me=true

Is there a feed that demonstrates the format of the new feed?

All comment feeds support the new format now. Some examples are below.

  • Relevance based feed:
    http://gdata.youtube.com/feeds/api/videos/9bZkp7q19f0/comments?prettyprint=true
  • Chronologically based feed:
    http://gdata.youtube.com/feeds/api/videos/9bZkp7q19f0/comments?prettyprint=true&orderby=published

Can I still create a comment via the API?

Yes, but to write new comments with the v2 API, there are several requirements:

  1. The authenticated user must have a YouTube channel linked to a Google+ account (API details)
  2. The request must be sent over HTTPS (current versions of the legacy client libraries support this by default)

If either of these requirements aren’t met, the API returns an error.

Google+ powered comments offer threading. What does this mean for YouTube comment replies?

Comment replies made before the transition now appear as regular comments. In addition, replying directly to comments via the YouTube API is no longer supported. At this time, there's no way of replying to a new-style comment via the YouTube API.

Replies to new-style YouTube comments via the YouTube and Google+ sites and apps are not returned with the legacy API's comment feed. However, you can get the actual replies via the Google+ APIs.

If a YouTube comment feed entry represents a new-style comment, the entry contains a <yt:googlePlusUserId> tag. If that tag is present and the comment has any replies (just check the <yt:replyCount> element), then you can parse the Google+ Activity ID from the entry's <id> tag. You can use that ID to call the Google+ API's comments:list method to retrieve a list of recent replies to that comment.

The excerpt below demonstrates how a Google+ Activity ID, shown in bold text, appears in a comment feed entry:

<entry>
  <id>tag:youtube,2008:video:xpI6VNvRTII:comment:z13rtnibotmidjggs04cdvzgvurngv3pwnw0k</id>
  <yt:googlePlusUserId>123456789</yt:googlePlusUserId>
  <yt:replyCount>4</yt:replyCount>
  <yt:channelId>UCxxxx_xxxxx</yt:channelId>
  ...
</entry>

What happens on Google+ when I make a comment via the YouTube API?

Making a comment via the YouTube API doesn't generate a post in your Google+ stream nor does it create a Google+ notification.

Do comments continue to show up in the activity feed since the switch to the new commenting system?

No, not at this time.

Does SUP in the legacy API continue to work for comments?

No, not for comments. SUP relies on the user activity feed. Since comments are no longer in the activity feed, they do not show up in SUP.