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

Add filename to YouTube API upload

$
0
0

I've been getting a "Raw: Unknown" filename for the videos I've been uploading to YouTube using the API. Looking at the YouTube API Library, I've seen that there is a

Google_Service_YouTube_VideoFileDetails()

method where you can set the filename, but when I try it I get the following error:

Caught Google service Exception 400 message is {error": {"errors": [{"domain": "youtube.part","reason": "unexpectedPart","message": "{0}","locationType": "parameter","location": "part"}],"code": 400,"message": "{0}"}} 

Here is my code:

$snippet = new Google_Service_YouTube_VideoSnippet();        $snippet->setTitle("Test title");        $snippet->setDescription("Test description");        $snippet->setTags(array("tag1","tag2"));        $snippet->setCategoryId("27");        $status = new Google_Service_YouTube_VideoStatus();        $status->setPrivacyStatus('private');        $status->setPublishAt("2019-08-13T13:13:13.1Z");        $status->setEmbeddable(false);        $fileDetails = new Google_Service_YouTube_VideoFileDetails();        $fileDetails->setFileName("WI_YOUTUBE_COMMA_DESCRIPTION.mp4");        $video = new Google_Service_YouTube_Video();        $video->setSnippet($snippet);        $video->setStatus($status);        $video->setFileDetails($fileDetails);             $chunkSizeBytes = 1 * 1024 * 1024;         $client->setDefer(true);        $insertRequest = $youtube->videos->insert("status,snippet,fileDetails", $video,            array('onBehalfOfContentOwner' => $contentOwnerId,'onBehalfOfContentOwnerChannel' => $channelId));

Viewing all articles
Browse latest Browse all 3831

Trending Articles



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