Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

How to get relatedVideos based on videoId from youtube API v3?

$
0
0

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


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>