【问题标题】:uploading video to Youtube with API Processing abandoned The video could not be processed error将视频上传到 Youtube 并放弃 API 处理视频无法处理错误
【发布时间】:2021-10-12 23:20:33
【问题描述】:

我想将视频上传到 YouTube。所以我的代码就这样剪断了:

      var request: any = await Youtube.videos.insert({
            resource: {
                snippet: {
                    title: title
                    , description: description
                }
                , status: {
                    privacyStatus: "private"
                }
            }
            , part: "snippet,status"

            , media: {
                body: fs.createReadStream(file)
            }
        }, (err: any, data: any) => {
            if (err) {
                console.log(err.response.data.error)
            }
            console.log("Video upload to youtube Successfull.");
        });

但是当我检查我的 YouTube 频道时,我收到一个错误

处理放弃视频无法处理

为什么会出现这个错误?我怎么解决这个问题?请帮忙!

【问题讨论】:

    标签: node.js google-api youtube youtube-api youtube-data-api


    【解决方案1】:

    在我看来,它可能不会上传视频本身,只是上传元数据。试试这个。

    const youtube = google.youtube({version: 'v3', auth});
    var fileMetadata = {
      'title': title
    };
    var media = {
      body: fs.createReadStream(file)
    };
    youtube.videos.insert({
      resource: fileMetadata,
      media: media,
      fields: 'id'
    }, function (err, file) {
      if (err) {
        // Handle error
        console.error(err);
      } else {
        console.log("Video upload to YouTube Successful.");;
      }
    });
    

    【讨论】:

      猜你喜欢
      • 2020-10-24
      • 2020-02-26
      • 1970-01-01
      • 1970-01-01
      • 2020-03-06
      • 2014-11-23
      • 2011-07-31
      • 2016-05-23
      • 2012-01-02
      相关资源
      最近更新 更多