-
Notifications
You must be signed in to change notification settings - Fork 5
/
replay.html
42 lines (40 loc) · 1.66 KB
/
replay.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
layout: single
title: Replay
decription: Les conférences de l'association ADD en vidéo sur notre chaîne YouTube
---
<script type="text/html" id="card-template">
<div class="col-md-4 col-sm-6 mb-3">
<div class="card">
<img width="100%" class="card-img-top" src="{image}" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">{title}</h5>
<p class="card-text">{description}</p>
<a href="{link}" target="_blank" class="btn btn-primary">Voir la video</a>
</div>
</div>
</div>
</script>
<h2 class="mb-4"><i class="fab fa-youtube"></i> Les conférences de l'association ADD en vidéo</h2>
<div class="row" id="videos"></div>
<script>
$(function(){
let apiKey = 'AIzaSyAFuQSuuh7Q6R7ruZQD60NyfwWudXp3oLg';
let channelId = 'UCGeZ9KihmkrUc_Zq9EcDFUQ';
let entrypoint = 'https://www.googleapis.com/youtube/v3/search?key='+apiKey+'&channelId='+channelId+'&part=snippet,id&order=date&maxResults=21&type=video';
$.get(entrypoint, (result) => {
let $container = $('#videos');
let htmlCard = window['card-template'].innerHTML;
$container.html('');
$.each(result.items, (key, item) => {
console.log(item);
$container.append(template(htmlCard, {
'image' : item.snippet.thumbnails.high.url,
'title' : item.snippet.title,
'description' : item.snippet.description,
'link' : 'https://www.youtube.com/watch?v='+item.id.videoId
}));
});
});
});
</script>