Finding the total number of comments for a Video Entry with the Python Client Library


The snippet below shows how to retrieve the total number of comments for a video entry by examining the comment feed object using the interactive shell:
>>> import gdata.youtube.service
>>> client = gdata.youtube.service.YouTubeService()
>>> feed = client.GetRecentlyFeaturedVideoFeed()
>>> # fetching the first entry from the recently featured video feed
>>> entry = feed.entry[0]
>>> entry.title.text
"Follow Obama's nomination week: youtube.com/2008conventions"
>>> # fetching the comment feed
>>> comments = client.GetYouTubeVideoCommentFeed(video_id='9N4GOpSt5OI')
>>> # printing the text contents of the total_results element
>>> # note that this element is part of every feed
>>> comments.total_results.text
'578'
Alternatively, if you want to eliminate the actual request to catch the comment feed itself, you can parse out the number of comments by examining the 'countHint' attribute of the comment feedLink:
>>> entry.comments.feed_link[0].count_hint
'50'

5 comments:

kosovohp03 said...

healthtips
healthtips
healthtips
healthtips
healthtips




socks proxy
socks proxy
socks proxy
socks proxy
socks proxy
socks proxy
socks proxy
socks proxy
socks proxy
socks proxy
check socks proxy
socks proxy
socks proxy






funnystory
funnystory
funnystory
funnystory
funnystory




funny pictures
funny pictures
funny pictures
funny pictures
funny pictures
funny pictures






Girl Xinh
Girl Xinh
Girl Xinh
Girl Xinh
Girl Xinh
Girl Xinh
Girl Xinh





cute animal
food news
internet
football news
bank news
marketing
science news
travel vietnamt
real estate vietnam
business news
music news
health news
software
seo news

Jatin Sethi said...

De-tox is an approach to free your high schooler's body of all the hurtful synthetic compounds that drugs or liquor have deserted. Similarly as with most drugs, withdrawal indications can prompt extraordinary queasiness and even agony.
quotes on addiction recovery
quotes about drug recovery

augustwalker said...

fix hp printer in error state status displays that there may be a problem with printer itself. Make sure printer is turned on and connected to PC.

Printer Repair City said...

Amazing, learn how to resolve Canon Printer Error u052 and solve canon printer error 6a81 Also canon printer error 5200 and this is good Canon Printer Error Code 1007 find out canon printer error e04 as well as canon printer error code p22

printerrstart said...

I really enjoyed this information.
Thanks for sharing this wonderful piece of information.
With the help of my websites and blogs you can get more easy guidelines to setup, configure and troubleshoot your printers.
In case if you have any queries and to solve your troubles just check into my websites or blogs to resolve your canon.com/ijsetup problems.