export const create = (filePath) => {
return youtubeApi({
method: 'post',
// url: path + '?organization_id=581594806',
url: path,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/octet-stream',
},
params: {
part: 'id,snippet,status',
},
requestBody: {
snippet: {
title: 'Node.js YouTube Upload Test',
description: 'Testing YouTube upload via Google APIs Node.js Client',
categoryId: 'Entertainment'
},
status: {
privacyStatus: 'private'
},
},
media: {
body: fs.createReadStream(filePath, {encoding: 'utf8'}),
},
});
console.log('it reaches here 00000000000000000000000000000000000000000000000000000000000000000000')
};
Я пытаюсь загрузить видеофайл на YouTube, используя приведенный выше код, но получаю следующую ошибку:
response: {
status: 403,
statusText: 'Forbidden',
headers: {
'x-guploader-uploadid': 'AEnB2UqGezfF48i9hTqocWETPGR-jTRqLUAAaD0CiEu3CUJI3pKjv2H7ujBNfo8fvLntSc6-UPf_ZGuEk8Zb0rlI6xMj3dt0FMsXHPX47uWdTeXOneJ-o0o',
vary: 'Origin, X-Origin',
'content-type': 'application/json; charset=UTF-8',
'content-length': '987',
date: 'Thu, 27 Feb 2020 09:41:39 GMT',
server: 'UploadServer',
'alt-svc': 'quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000'
},