Upload video to Youtube by Nodejs

學習Blog
Code學習紀錄
Published in
May 15, 2022

Prerequisite:
1. google account
2. nodejs
3. Node Package Manager

Part 1 Create Project

1. Go to Google Cloud Platform and create a new project

2. Enable Youtube API

3. Create credentials to access API

For uploading videos, choose OAuth client ID, see reason

set type as Web application, and specific app origins and redirect URIs

download client_secret.json file

4. Set OAuth consent screen to access API

add scopes
add test users if necessary

Part 2 Create node.js project

  1. install module

2. create OAuth client instance

3. get user Auth

4. upload video to youtube with user’s auth token

  1. Videos:insert
  2. Requrest Body

--

--