我知道这个问题是重复的,但现象不同。
我使用 Youtube API PHP 上传我的视频。不幸的是,它捕获了错误:
{
"status": "fail",
"mess": "Failed to start the resumable upload (HTTP 400: youtube.video, The request metadata specifies an invalid video description.)"
}
Run Code Online (Sandbox Code Playgroud)
我检查了描述。使用mb_strlen()少于 5000 个字符的返回结果。
$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);
Run Code Online (Sandbox Code Playgroud)
有一些特殊字符存在:<>, |, '(single qoute), (), ?, "(双引号)。
我研究了这个错误,但没有任何结果:(
您需要< >从描述中删除所有字符。
$description = str_replace(['>', '<'], '', $description);
$snippet->setDescription($description);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2588 次 |
| 最近记录: |