Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

How to insert featured comments with Youtube API

$
0
0

I'm inserting videos on youtube using API in PHP version. But I'm not able to include a highlight comment in the videos. In the youtube documentation the example is in json , and as I'm doing it in php it just doesn't work.

See part of my code is like this:

// Create a snippet with title, description, tags and category ID    // Create an asset resource and set its snippet metadata and type.    // This example sets the video's title, description, keyword tags, and    // video category.    $snippet = new Google_Service_YouTube_VideoSnippet();    $snippet->setTitle("Cats are cute #".$filme['Data ID']);    $snippet->setDescription($filme['titulo']);    $snippet->setTags('cats','cutecats','cute');    // Numeric video category. See    // https://developers.google.com/youtube/v3/docs/videoCategories/list    $snippet->setCategoryId("19");    // Set the video's status to "public". Valid statuses are "public",    // "private" and "unlisted".    $status = new Google_Service_YouTube_VideoStatus();    $status->privacyStatus = "public";    // Associate the snippet and status objects with a new video resource.    $video = new Google_Service_YouTube_Video();    $video->setSnippet($snippet);    $video->setStatus($status);

And the youtube suggestion to include comments using the API is this:

{"snippet": {"channelId": "UC_x5XG1OV2P6uZZ5FSM9Ttw","topLevelComment": {"snippet": {"textOriginal": "This video is awesome!"    }   },"videoId": "MILSirUni5E"  } }

I tried like this and it didn't work:$snippet->textOriginal('My comment');

How can I submit a featured comment using youtube API in php?


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>