I am using the Youtube Data API (v3) to find, load and display a video with all its information. However, I want to also show other video suggestions next to it. These should be similar to the content of the video that is currently being watched.
I thought that I could do that with the topicId
or the videoCategoryId
parameter of the search list. However, I don't know how I can get the category or topic of the main video. All possible information I can get is the following:
- contentDetails
- fileDetails
- id
- liveStreamingDetails
- localizations
- player
- processingDetails
- recordingDetails
- snippet
- statistics
- status
- suggestions
- topicDetails
How can I get the topic of a video and then use it to find other ones that are similar?
There are topicDetails
and snippet.categoryId
.
Note that directly using the filter relatedToVideoId
from the YouTube Data API v3 Search: list endpoint would maybe make more sense.
Update-
The search.list method's relatedToVideoId
parameter has been deprecated from August 7, 2023 by YouTube.
https://developers.google.com/youtube/v3/revision_history#june-12,-2023