2017-12-12 11 views
0

코드는 오류가 아니지만 YouTube 페이지에는 아무 것도 없습니다. 토큰은 괜찮습니다. 로그가 끝났다고 말할 수는 있지만 YouTube에서는 아무것도 볼 수 없습니다. YouTube에서 비디오를 표시하는 데 시간이 얼마나 걸립니까?youtube-api를 통해 업로드 한 동영상을 볼 수 없습니다.

const Youtube = require("youtube-api"), 
    fs = require("fs"), 
    readJson = require("r-json"), 
    Logger = require("bug-killer"), 
    prettyBytes = require("pretty-bytes"); 

// I downloaded the file from OAuth2 -> Download JSON 
const CREDENTIALS = readJson(`${__dirname}/credentials.json`); 

// Authenticate 
let oauth = Youtube.authenticate({ 
    type: "oauth", 
    client_id: CREDENTIALS.web.client_id, 
    client_secret: CREDENTIALS.web.client_secret, 
    redirect_url: CREDENTIALS.web.redirect_uris[0] 
}); 

//the token obtained with getToken.js script 
var tokens = readJson(`${__dirname}/tokens.json`); 

//set the token 
oauth.setCredentials(tokens); 

var req = Youtube.videos.insert({ 
    resource: { 
    snippet: { 
     title: "Testing", 
     description: "Test video upload via YouTube API" 
    }, 
    status: { 
     privacyStatus: "public" 
    } 
    }, 
    part: "snippet,status", 
    media: { 
    body: fs.createReadStream("video.mp4") 
    } 
}, (err, data) => { 
    console.log("Done."); 
    process.exit(); 
}); 

setInterval(function() { 
    Logger.log(`${prettyBytes(req.req.connection._bytesDispatched)} bytes uploaded.`); 
}, 250); 
+0

동영상을 업로드하기위한 문서에는 [NodeJS Full Sample] (https://developers.google.com/youtube/v3/docs/videos/insert)이 있습니다. – noogui

답변

1

해결되었으므로 YouTube 앱을 사용 설정해야합니다. 바보 같은 문제.