Sign up for Youtube API

  1. https://console.developers.google.com
  2. create project
  3. click “Enable APIs and Services”
  4. search for “YouTube Data API v3”, “enable” it
  5. create credentials ( or use Credentials on the sidebar )

Where will you be calling the API from?

Web browser(Javascript)

What data will you be accessing?

>Public data

User data

6. get Your credentials ( API key )

 

Install axios : AJAX request

npm install --save axios

 

from axios import 'axios'

axios.get('https://www.googleapis.com/youtube/v3/search', {
params: {
key: API_KEY,
type: 'video',
part: 'snippet',
q: searchTerm
}
}).then(response => console.log(response));

// response.data.items.0.id

// response.data.items.0.snippet 

 

API references : https://developers.google.com/youtube/v3/docs/

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s