When we view the YouTube page, and click Music, we are able to see them on different genre's like "Rap", "Rock", "Country", etc.
How can I retrieve this data (the genre-wise listing of videos) using the YouTube Apis.?
One way to do this is using the Topics API integration with V3 of the API. Take a look at the videos.list() API call. Plug in these values:
The ID of that video corresponds to Carly Rae Jepsen's "Call Me Maybe". When you look at the JSON response, you'll see a list of topic IDs:
[ "/m/015f7", "/m/0h55y27", "/m/0gkxzs6", "/m/064t9" ]
These are Freebase machine IDs. You would then make a Freebase API call to retrieve information about that particular topic. For instance, /m/064t9 corresponds to "Pop Music".
Thise method won't work for 100% of videos on YouTube; Metallica's "Whiskey in a Jar" only returns topics for the song and the band, however, Britney Spear's "I Want to Go" correctly returns a machine ID for "Pop Music".
The reason for this is that the Topic is often machine generated, not human curated (though we do quality checks). We did a Google I/O talk about how this works. The good news is that once you DO have a machine ID, it's very easy to find other videos by topic ID. Our samples demonstrate how to do this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With