moonlightlane
moonlightlane

Reputation: 111

youtube api - retrieve "music in this video" info from video metadata?

I have done some search on the web but could not find a way to retrieve information about a piece of music used in a video (NOT music video), using youtube api.

For example, in the description of this video or this video, there is a separate section about "music in this video", and there one can find information about the title of the song, the artist, the album, license, etc..

enter image description here

What I would like to do is to retrieve this information using youtube api. Unfortunately, so far I have not had any success spotting this piece of information using youtube api. The metadata returned simply does not contain the music information (I can retrieve information such as commentCount, dislikeCount, etc..).

Is it possible to retrieve the information of music used in a video, if such information is present in the video description? Thanks in advance!

Upvotes: 8

Views: 3226

Answers (1)

ramiro
ramiro

Reputation: 898

There is no documented official API method, but you can use youtube-dl from a Python program to get this information, e. g.

import youtube_dl

url = 'https://www.youtube.com/watch?v=6_b7RDuLwcI'
ydl = youtube_dl.YoutubeDL({})
with ydl:
    video = ydl.extract_info(url, download=False)

print('{} - {}'.format(video['artist'], video['track']))

Upvotes: 5

Related Questions