1
votes

I am currently using the Google YouTube V3 API to get view counts for few videos on You Tube. I would like to parse the response to get results when view counts cannot be retrieved. Example “This video is private” or “The uploader has not made this video available”

I need to retrieve this part “This video is private”.

Here is a snippet of my code

Using Google.Apis.Youtube.v3.YoutubeService

private YoutubeService youtube;

var YTVideo = youtube.Videos.List(ytidobj.ToString(), "statistics");

var ViewCountResponse = YTVideo.Fetch()

I am able to get view counts from this call without any issues but I can’t seem to get the error responses?

How can get the error responses back from the the call : var ViewCountResponse = YTVideo.Fetch()

2

2 Answers

0
votes

I tried to access the details of my private YouTube video from two accounts, one of which is the owner of the video, via YouTube Data API v3. The owner of the video received the full properties (including "privacyStatus": "private" with no issues, but the other account received a 200 OK response without any properties or details.

It seems like only the owners of the private videos are given a response, while other users will receive an empty response as though no such videos exist. YouTube Data API - Errors does not seem to include error responses for private videos either.

If you need to inform the user should there be an empty response, I suggest a message of "This video does not exist or is made private by the uploader" or something similar.

If you need to know if a video exists but is private, without being its owner, I don't think the v3 API is capable of that.

0
votes

Which is making sense. The "private" state would not be private, if anyone could see there is a video.