Access to like-or-dislike feature through youtube

2019-08-20 03:40发布

问题:

I have an asp.net application where users can upload videos to youtube, view the uploaded videos and vote for a video if they wish. All the above except the voting part is working.

I had a look at the sample code in the youtube api dot net developers guide: video.Rating = 5; request.Insert(video.RatingsUri, video);

but keep on getting an error saying I need to authenticate. If i authenticate its works fine.

My question is my do I need to authenticate when I add a rating(like/dislike) for a video through the api but if you go to www.youtube.com you can rate(like/dislike) a video without logging into your personal youtube account first?

What do I need to do to add a rating to a video without authenticating first?

Thanks

回答1:

According to the API at: http://code.google.com/intl/de-DE/apis/youtube/2.0/developers_guide_protocol.html#Ratings

In section "Adding a rating" it says:

To add a rating to a video, send an authenticated POST request to the video's ratings URL. The user who is rating the video must be identified by the authentication token.

It looks like you must authenticate a user when you use the API. Even when it is possible to rate withouth login as a normal user using a browser. Maybe some API limitation to prevent abuse.