I am working on a YouTube clone from YouTube API v3, whereas I need to related videos list based on the current playing video’s videoId.
async function getApiData(videoId) {
const res = await apiRequest('/search', {
params: {
part: 'snippet',
videoCategoryId: videoId, // relatedToVideoId : videoId
maximumResult: 10,
type: 'video'
}
})
console.log("res", res)
return res;
}
In the params, I have passed videoCategoryId/relatedToVideoId, in different requests.
but it sends an error message.
What would be the correct way to get a related video list from the YouTube API based on the videoId?
Thanks for your support