How to update HTML of Youtube video snippet description from the API exposed through Google Apps Script?

泪湿孤枕 提交于 2020-01-25 03:10:36

问题


I want to update my Youtube video snippet.description from the API exposed through Google Apps Script. The snippet contains formatting so I am trying to use HTML. I expect to see the updated snippet on my Youtube video. But I get the following error instead.

API call to youtube.videos.update failed with error: The request metadata specifies an invalid video description. (line 88, file "Youtube")

How can I format my video description?

Youtube.gs
function updateVideo( data ) {
  var videoId = 'foo';
  var title = 'bar';
  var description = '<p>baz</p><p>bat</p>';
  var resource = {
    id: videoId,
    snippet: {
      title: title,
      description: description,
      categoryId: '22'
    }
  };
  YouTube.Videos.update(resource, 'id,snippet'); // this is line 88
}

回答1:


You can't use HTML so you have to use string symbols for newline \n and tab \t, etc.

var description = 'baz\n\nbat';

I don't know how to add other HTML features like links, etc. Maybe someone else can improve upon this answer by adding that information if they know how to do it.



来源:https://stackoverflow.com/questions/59039711/how-to-update-html-of-youtube-video-snippet-description-from-the-api-exposed-thr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!