Looking for a way to grab all thumbnails from YouTube or Instagram
Need to paste a list like this (yes, they don’t lead anywhere)
youtube.c/watch?v=bAG
youtube.c/watch?v=zE7j
youtube.c/watch?v=Zu4
youtube.c/watch?v=26fI
or a Playlist
youtube.c/watch?v=wlCs&list=UULF
If you know any of the following:
Link to a website
App
Free Service
1 Like
Yes, you can use the Youtube API v3 to pull anything from your YT Channel. Including specific playlists.
The API is pretty good, I have used it before (with Blocs)
There is a limit for the free version. But it’s a lot for most use cases, so should be fine.
Example I have used for test case a while back.
- Go to Googles cloud console, and create a new project with Youtube API v3.
- Generate the API key for it.
- Create the javascript for your website.
Example code. This will just create a list of videos from your channel, you need to add your API key and playlist ID.
const API_KEY = 'YOUR_API_KEY';
const PLAYLIST_ID = 'YOUR_PLAYLIST_ID';
function getYoutubeVideos() {
fetch(`https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=${PLAYLIST_ID}&key=${API_KEY}`)
.then(response => response.json())
.then(data => {
const container = document.getElementById('youtube-videos');
data.items.forEach(item => {
const videoId = item.snippet.resourceId.videoId;
const title = item.snippet.title;
const thumbnailUrl = item.snippet.thumbnails.default.url;
const videoLink = `
<a href="https://www.youtube.com/watch?v=${videoId}" target="_blank">
<img src="${thumbnailUrl}" alt="${title}">
<h3>${title}</h3>
</a>
`;
const videoContainer = document.createElement('div');
videoContainer.classList.add('youtube-video');
videoContainer.innerHTML = videoLink;
container.appendChild(videoContainer);
});
})
.catch(error => {
console.error('Crap! Something went wrong:', error);
});
}
getYoutubeVideos();
Thank you, Pete
I will delve into this. I am still in learning mode.
For anyone interested I did find this gem, while waiting for anyone to answer.
If it is your YT channel you already have all that art work, well you should.
By the way, the example code I gave above, needs to be modified for your use case, it’s just an example.
Change the HTML to suit your needs.
I did have ideas to make this a bric and create a video playlist etc. but it’s all in the full in-tray ![:joy: :joy:](https://forum.blocsapp.com/images/emoji/twitter/joy.png?v=12)