<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var youtubeItems = '';
$.get(
"https://www.googleapis.com/youtube/v3/playlistItems",{
part : 'contentDetails',
maxResults: 5,
playlistId : 'PLvF1USDppY7_TiA7AwGD7OEob9hhQAgLe', // Get channel id from youtube -- Settings->Advance Settings
key: 'AIzaSyBBPbqqUz7-imx-am5uG8DGhhxcf-dzuVU'
}, // Get youtube data v3 api key from Credential #slack
function(data) {
$.each( data.items, function( i, item ) {
console.log(item);
if(item.kind == "youtube#playlistItem") {
youtubeItems += '<iframe width="560" height="315" src="https://www.youtube.com/embed/'+item.contentDetails.videoId+'" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
}
})
$('.youtube-items').html(youtubeItems);
}
);
});
</script>
<div class="youtube-items"></div>
<script type="text/javascript">
$(document).ready(function() {
var youtubeItems = '';
$.get(
"https://www.googleapis.com/youtube/v3/playlistItems",{
part : 'contentDetails',
maxResults: 5,
playlistId : 'PLvF1USDppY7_TiA7AwGD7OEob9hhQAgLe', // Get channel id from youtube -- Settings->Advance Settings
key: 'AIzaSyBBPbqqUz7-imx-am5uG8DGhhxcf-dzuVU'
}, // Get youtube data v3 api key from Credential #slack
function(data) {
$.each( data.items, function( i, item ) {
console.log(item);
if(item.kind == "youtube#playlistItem") {
youtubeItems += '<iframe width="560" height="315" src="https://www.youtube.com/embed/'+item.contentDetails.videoId+'" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
}
})
$('.youtube-items').html(youtubeItems);
}
);
});
</script>
<div class="youtube-items"></div>
No comments:
Post a Comment