La fonction de suggestion automatique permet d'affiner rapidement votre recherche en suggérant des correspondances possibles au fur et à mesure de la frappe.
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?
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:
$.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).
There is a Hubspot-made YouTube app 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.
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:
$.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).
There is a Hubspot-made YouTube app 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.