I know this question is duplcated, but the phenomena is different.
I use Youtube API PHP to upload my videos. Unfortunately, its caught errors:
{
"status": "fail",
"mess": "Failed to start the resumable upload (HTTP 400: youtube.video, The request metadata specifies an invalid video description.)"
}
I checked the description. Use mb_strlen()
return result less than 5000 characters.
$title = mb_substr($title, 0, 100);
$description = mb_substr($description , 0, 4999);
$tags = array_slice($tags, 0, 15);
$snippet = new Google_Service_YouTube_VideoSnippet();
$snippet->setTitle($title);
$snippet->setDescription($description);
$snippet->setTags($tags);
$snippet->setCategoryId("22");
$status = new Google_Service_YouTube_VideoStatus();
$status->privacyStatus = "public";
$video = new Google_Service_YouTube_Video();
$video->setSnippet($snippet);
$video->setStatus($status);
Have some special characters exist: <>
, |
, '
(single qoute), ()
, ?
, "
(double quote).
I researched about this error, but not any results :(
You need to remove all <
>
characters from your description.
$description = str_replace(['>', '<'], '', $description);
$snippet->setDescription($description);