How To Embed YouTube Videos Using RSS Feed

How To Embed YouTube Videos Using RSS Feed

If you're curious about how to embed YouTube videos from your channel or playlist on your website or personal portfolio, check out this four-step tutorial.

Vaishnav Chandurkar

Vaishnav Chandurkar

Sep 28, 2023 4 min read

We wanted to introduce YouTube integration with your Peerlist profile for a very long time. After multiple POCs, we realized that fetching videos via RSS feed is the most efficient and effective way to go ahead.

In this tutorial, I'll guide you through a simple process of how to embed your favorite YouTube videos on your personal portfolio or website. Let's get started with these four simple steps.

You can embed all videos from a channel or from a specific playlist. Depending on that:

Step 1: Get a YouTube Channel ID or Playlist ID

How to find YouTube Playlist ID?

You can easily get playlistId directly from the playlist URL

Here's the sample URL:

The "list=" parameter is followed by PLoa864sF4gBmwd50ZLZFfzV0IZXFm_q7W as the playlist ID.

How to find the YouTube channel's channel ID?

  1. Visit the channel home page. ex:
  2. Go to the About section, scroll down to the Stats section.
  3. Click the Share button below. Click on the Copy channel ID.
How to find YouTube channel's channel ID
How to find YouTube channel's channel ID

You will get a channel ID something like this UCT5jsrerQIrgFhjscRM5TTA

Step 2: Create a YouTube RSS URL for Your Content

Now that you have the ChannelID or Playlist ID, you can create a YouTube RSS URL. The format for these URLs is as follows:

For Channels:{{YOUR_CHANNEL_ID}}

For Playlists:{{YOUR_PLAYLIST_ID}}

Replace "YOUR_CHANNEL_ID" or "YOUR_PLAYLIST_ID" with the respective ID you obtained in Step 1. This URL will point to the RSS feed for your selected channel or playlist.

If you visit the RSS URL, you will get something like this

<feed xmlns:yt="" xmlns:media="" xmlns="">
  <link rel="self" href=""/>
  <title>What's New with Peerlist</title>
  ... // RSS content entry
  ... // RSS content entry
  ... // RSS content entry

Now we need to parse this data for the required fields.

Step 3: Integrate YouTube Content into Your Portfolio

To parse RSS XML data we can use rss-parser. A small library for turning RSS XML feeds into JavaScript objects.

// /api/youtube
const Parser = require('rss-parser');
const parser = new Parser();


const handler = async (req, res) => {
	const feed = await parser.parseURL(youtubeRSSURL); // Replace with the URL from Step 2

	if (!feed || !feed.items.length) {
		return res.status(404).send({
			success: false,
			message: 'Could not fetch YouTube channel videos',

		success: true,

export default handler;

The rss-parser will parse the data present at the RSS URL and return the response as follows:

// JSON response from rss-parser
	"link": "",
	"feedUrl": "",
	"title": "What's New with Peerlist",
	"author": "Peerlist",
	"items": [
			"title": "Peerlist Monthly Product Update - January 2023",
			"link": "",
			"pubDate": "2023-02-15T10:06:01.000Z",
			"author": "Peerlist",
			"id": "yt:video:Rl9HHiic9rY",
			"isoDate": "2023-02-15T10:06:01.000Z"
			"title": "Peerlist Product Update: March 2023",
			"link": "",
			"pubDate": "2023-04-06T05:13:19.000Z",
			"author": "Peerlist",
			"id": "yt:video:ufa4Sz-hn3E",
			"isoDate": "2023-04-06T05:13:19.000Z"

Step 4: Render Data on UI with YouTube Embed

Once you have the JSON data from the RSS feed, you can render it on your UI.

// VideoList (ReactJs Component)
import { useEffect, useState } from 'react';

function VideoList() {
	const [youtube, setYoutube] = useState(null);

	useEffect(() => {
		async function fetchData() {
			const items = await axios.get('/api/youtube')
	}, []);

	// Function to convert video link to embed link
	const getYoutubeEmbedURL = (link) {
		// Extract video ID from the link
		const videoId = link.split('v=')[1];
		return `${videoId}`;

	return (
			<div className='mb-6'>
				<p className='text-lg font-medium'>{}</p>
			{youtube.items?.length > 0 && (
				<ul className='grid grid-cols-2 gap-4'>
					{ => {
						const embedURL = getYoutubeEmbedURL(;

						return (
								className='rounded-lg bg-white hover:shadow border border-zinc-300 overflow-hidden'
									className='w-full h-64'
								<div className='p-4'>
									<p className='text-sm'>{video.title}</p>

export default VideoList;

Please note: Don't forget to modify the CSS according to your design. The above code contains Tailwind CSS classes.

That's it! You now have a basic setup to fetch and embed YouTube videos from a channel or playlist using a YouTube RSS feed. If you've any questions or feedback, you can DM me. You can find me here on Peerlist → Vaishnav