How can I get number of like/deslike

Showing 1-2 of 2 messages
How can I get number of like/deslike Ahikam Oren 1/12/11 1:23 AM
I'm working on a project in c# (wpf) and I would like to konw how to get the number of users the likes/deslike a video
Thans Ahikam
Re: How can I get number of like/deslike Jeffrey Posnick 1/13/11 2:12 PM
Hello Ahikam,

 There's no native support for deserializing likes/dislikes into a
property of the Video object in the .NET client library right now.
There might be more elegant ways of getting this information, but
here's some C# code that should work, assuming that the "video"
variable is a properly initialized Video object:

                int likes = -1;
                int dislikes = -1;
                XmlExtension ytRatingElement =
(XmlExtension)video.AtomEntry.FindExtension("rating", "http://");
                if (ytRatingElement != null)
                    foreach (XmlAttribute attribute in
                        switch (attribute.Name) {
                            case "numLikes":
                                likes = int.Parse(attribute.Value);

                            case "numDislikes":
                                dislikes = int.Parse(attribute.Value);

-Jeff Posnick, YouTube API Team
~ YouTube is hiring! ~ ~