Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Direct link to YouTube comments

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?

like image 457
BlueHelmet Avatar asked Aug 30 '17 18:08

BlueHelmet


2 Answers

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.

like image 88
Red Tehnic Avatar answered Sep 18 '22 02:09

Red Tehnic


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.

like image 32
Mr.Rebot Avatar answered Sep 22 '22 02:09

Mr.Rebot