# Using Youtube Data v3 API

**URL:** <https://community.hubspot.com/t/using-youtube-data-v3-api/21969>\
**Category:** CMS Development\
**Tags:** design-manager, local-development, javascript\
**Created:** [June 23, 2020, 5:42am UTC](https://community.hubspot.com/t/using-youtube-data-v3-api/21969 "2020-06-23T05:42:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fah08](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/fah08/32/25270_2.png) [@fah08](https://community.hubspot.com/u/fah08)\
**Post date:** [June 23, 2020, 5:42am UTC](https://community.hubspot.com/t/using-youtube-data-v3-api/21969/1 "2020-06-23T05:42:42Z")

</div>

Hi,

I am working on the page that helps me pull all the videos from a youtube channel. The aim is t auto populate the vidoes instead of myself updating/uploading new videos in the site.

What is the best way to acheive this? I planned to use youtube data v3 api. But How can this be done in hubspot cms?

---

<div class="post-metadata">

**Author:** ![sharonlicari](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sharonlicari/32/101479_2.png) [@sharonlicari](https://community.hubspot.com/u/sharonlicari)\
**Post date:** [June 26, 2020, 10:08am UTC](https://community.hubspot.com/t/using-youtube-data-v3-api/21969/2 "2020-06-26T10:08:44Z")

</div>

Hey @fah08

I’ll tag a few of our experts to see if they have been using this integration.

Hey @piersg @Anton @albertsg could you please share your thoughts with @fah08?

thanks & happy Friday!

Sharon

---

<div class="post-metadata">

**Author:** ![piersg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/piersg/32/99782_2.png) [@piersg](https://community.hubspot.com/u/piersg)\
**Post date:** [June 26, 2020, 2:05pm UTC](https://community.hubspot.com/t/using-youtube-data-v3-api/21969/3 "2020-06-26T14:05:10Z")

</div>

Hi @fah08.

You can embed a playlist of a YouTube user’s videos very easily (it will display all in one video frame):

`<iframe src="http://www.youtube.com/embed/?listType=user_uploads&list=[CHANNEL_NAME]" width="480" height="400"></iframe>`

The YouTube iFrame API will be more useful if you go down this route: [https://developers.google.com/youtube/iframe\_api\_reference](https://developers.google.com/youtube/iframe_api_reference)

If you want to do anything more complicated than that using the YouTube API, you can make an AJAX call in Javascript to the API. Something like:

```auto
$.ajax({
 url: "https://www.googleapis.com/youtube/v3/playlists",
 type: 'GET',
 dataType: 'json',
 data: {
 part : 'snippet', 
 channelId: [CHANNEL ID],
 maxResults : 50,
 key: '[API KEY]', 
 },
 success: function(data) {
 // do things with the result
 },
 error: function(xhr, status, error) {
 // handle any errors e.g. console.log(xhr.responseText);
 }
}); 

```

**However, this will expose your API key to the public** (and OAuth 2.0 client ID if you use that), unless you proxy the requests from your frontend JS through a separate server that can process the request and then make an authenticated request to YouTube.

Another option I think would work is to make your own Hubspot app which would allow you to hide your credentials (documentation [here](https://legacydocs.hubspot.com/docs/faq/how-do-i-create-an-app-in-hubspot)).

There is a Hubspot-made [YouTube app](https://ecosystem.hubspot.com/marketplace/apps/marketing/social-media/youtube) in the App Marketplace, but I’m not sure you can pull videos using it, I think it’s for pulling analytics data from YouTube but worth checking.
