Extracting YouTube Video's author using Python and YouTubeAPI
-
06-09-2019 - |
Question
how do I get the author/username from an object using:
GetYouTubeVideoEntry(video_id=youtube_video_id_to_output)
I'm using Google's gdata.youtube.service Python library
Thanks in advance! :)
Solution
So because YouTube's API is based on GData, which is based on Atom, the 'author' object is an array with name objects, which can contain names, URLs, etc.
This is what you want:
>>> client = gdata.youtube.service.YouTubeService()
>>> video = client.GetYouTubeVideoEntry(video_id='CoYBkXD0QeU')
>>> video.author[0].name.text
'GoogleDevelopers'
OTHER TIPS
Have you tried something like this?
foo = GetYouTubeVideoEntry(video_id=youtube_video_id_to_output)
foo.author
The docs for YouTubeVideoEntry aren't great, but the __init__
method seems to accept an author.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow