15

Is there a way to link directly to the comments section of a YouTube page?

I know that this can be done using anchors and div ids, but this has been unsuccessful when I applied it to a YouTube URL, because YouTube strips the forward slash on page load.

For example, https://www.youtube.com/watch?v=eRsGyueVLvQ/#comments becomes ?v=eRsGyueVLvQ#comments

Is this possible, or should this be chalked up to a feature request?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
BlueHelmet
  • 511
  • 2
  • 5
  • 18

2 Answers2

17

You can make a certain comment appear at the top of the comment section by clicking on how long ago it was posted (e.g. 2 years ago).

This will take you to the same YouTube video, but with a URL which looks something like this: https://www.youtube.com/watch?v=VIDEO_ID&lc=COMMENT_ID (just like in Mr.Rebot's answer).

You can also do this for replies as well.

Red Tehnic
  • 171
  • 1
  • 6
  • 2
    OMG I can't believe it's that simple. My whole life I was clicking on peoples comments from the notifications menu and thinking "oh the YouTube algorithm actually finds the best comments and brings it to the top and highlights it". I never realised that it's just because it's the comment link I clicked on from notifications menu. – David Callanan Jul 07 '21 at 19:46
  • 1
    This is a very useful, thanks. I'm looking for something though that puts the comments at the top of the page when they click the link (i.e an anchor link), such as: external-site.com/#anchor – BlueHelmet Oct 16 '21 at 17:56
3

If you will use the CommentThreads:list:

Returns a list of comment threads that match the API request parameters.

Code Snippets:

// Sample PHP code for commentThreads.list

function commentThreadsListByVideoId($service, $part, $params) {
    $params = array_filter($params);
    $response = $service->commentThreads->listCommentThreads(
        $part,
        $params
    );

    print_r($response);
}

commentThreadsListByVideoId($service,
    'snippet,replies',
    array('videoId' => 'kmXXXLBL3Nk'));

Then you can create a link with with the URL:

https://www.youtube.com/watch?v=VIDEO_ID&lc=COMMENT_ID

This link is not generated in the API so you should create a function for this.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Mr.Rebot
  • 6,703
  • 2
  • 16
  • 91
  • Since I want to link directly to the section of the youtube page where the comments begin, I am always going to want to link to the very first comment. Would that just be `https://www.youtube.com/watch?v=VIDEO_ID&lc=1` ? – BlueHelmet Aug 31 '17 at 18:20
  • There is a generated commentID for the specific comment which you can use to your link. You can follow the link provided above to get the commentID. – Mr.Rebot Sep 01 '17 at 03:41
  • Thanks. If more recent comments are added though, will that link go further and further away from the start of the comment section? In case I didn't explain well, I want this to be an external link that takes viewers to the actual youtube page. Specifically, to the top of the comments section. – BlueHelmet Sep 11 '17 at 18:46
  • I see. So the code you posted above will generate the commentID of the most recent comment? That way, it's always the top of the comments thread? – BlueHelmet Sep 12 '17 at 16:55