Skip to content

Instantly share code, notes, and snippets.

Last active December 16, 2021 13:13
What would you like to do?
Get YouTube videos of a channel
async function getYouTubeVideos() {
const youtubeApiKey = process.env.YOUTUBE_API_KEY // Get API key at
const channelId = process.env.CHANNEL_ID
const numberOfVideos = 10
const youtubeQuery = await fetch(
const youtubeQueryRes = await youtubeQuery.json()
const videos = [] => {
title: video.snippet.title,
channel: video.snippet.channelTitle,
thumbnail: video.snippet.thumbnails.medium,
publishedAt: video.snippet.publishedAt
return videos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment