← Main docs page

Get channel playlists

https://videomentions.com/api/v1/channel-playlists?id=${CHANNEL_ID}&continuation=${CONTINUATION}

This endpoint can be used for fetching a YouTube channel’s playlists.

Parameters

Response

Notes

Example 1: Basic usage

Below is an example request for getting the playlists belonging to the YouTube channel with an ID of UCddiUEpeqJcYeBxX1IVBKvQ.

curl -X GET 
-H "API-Key: your-api-key" 
-H "API-Secret: your-api-secret" 
https://videomentions.com/api/v1/channel-playlists?id=UCddiUEpeqJcYeBxX1IVBKvQ

Response

{
	"items": [
		{
			"id": "PL39u5ZEfYDEM83SgbGafPSqPk9UPhJjNF",
			"title": "Decoder = The Verge",
			"thumbnails": [
				{
					"url": "https://i.ytimg.com/vi/NIR1Yfvy2vQ/hqdefault.jpg?sqp=-oaymwEXCOADEI4CSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLDhqJuNZdzyv_nw87Tc3hCnOpvXPg",
					"width": 480,
					"height": 270
				}
			],
			"url": "https://www.youtube.com/playlist?list=PL39u5ZEfYDEM83SgbGafPSqPk9UPhJjNF",
			"videoCount": 2
		},
		{
			"id": "PL39u5ZEfYDEOC6P2KWHfF7ETE4fTzndu9",
			"title": "Apple WWDC 2023 - The Verge",
			"thumbnails": [
				{
					"url": "https://i.ytimg.com/vi/ZifujZQqQMo/hqdefault.jpg?sqp=-oaymwEXCOADEI4CSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLA6Aufna7j8dw75vwi7TvoVVr92Fg",
					"width": 480,
					"height": 270
				}
			],
			"url": "https://www.youtube.com/playlist?list=PL39u5ZEfYDEOC6P2KWHfF7ETE4fTzndu9",
			"videoCount": 2
		}
		// etc.
	],
	"continuation": "4qmFsgLCARIYVUNkZGlVRXBlcUpjWWVCeFgxSVZCS3ZRGnRFZ2x3YkdGNWJHbHpkSE1ZQXlBQU1BRTRBZW9EUEVOblRrUlJhbEZUU2tKSmFWVkZkM3BQV0ZVeFYydFdiVmRWVWtaVU1GSnRaVVZzYmxsc09VdFJNblJ6VW1wS1ZWcFhaR1pWYmxJelUzbG5PQSUzRCUzRJoCL2Jyb3dzZS1mZWVkVUNkZGlVRXBlcUpjWWVCeFgxSVZCS3ZRcGxheWxpc3RzMTA0"
}

Example 2: Pagination

Below is an example showing how to get paginated results in JavaScript/TypeScript.

Notice that the continuation string from page 1 is provided as a parameter to get page 2. This process can be repeated to get pages 3, 4, etc. When no more pages remain, the value of continuation will be null.

const channelId = 'UCddiUEpeqJcYeBxX1IVBKvQ';

// Fetch page 1
const pageOneResponse = await fetch(
	`https://videomentions.com/api/v1/channel-playlists?id=${channelId}`,
	{
		headers: {
			'API-Key': 'your-api-key',
			'API-Secret': 'your-api-secret',
		},
	}
);
const pageOneData = await pageOneResponse.json();
console.log('Page 1 results:', pageOneData.items);

// Verify that a next page exists
const haveNextPage = pageOneData.continuation !== null;
if (!haveNextPage) {
	// Don't attempt to fetch the next page if no more pages remain
	return;
}

// Fetch page 2
const pageTwoResponse = await fetch(
	`https://videomentions.com/api/v1/channel-playlists?id=${channelId}&continuation=${pageOneData.continuation}`,
	{
		headers: {
			'API-Key': 'your-api-key',
			'API-Secret': 'your-api-secret',
		},
	}
);
const pageTwoData = await pageTwoResponse.json();
console.log('Page 2 results:', pageTwoData.items);