Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extracting YouTube Video's author using Python and YouTubeAPI

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! :)

like image 923
alimango Avatar asked Jun 02 '09 09:06

alimango


1 Answers

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'
like image 179
Steph Liu Avatar answered Sep 27 '22 17:09

Steph Liu