Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3638

How to get comments on members-only YouTube videos using the YouTube API

$
0
0

What I want to do

I want to collect comments on all videos published on a particular other person's YouTube channel.

What I did

Use API-Key

I issued an API key from the Google Cloud Console and accessed the following URL.

If the VIDEO_ID is a public video, I can get comments. But if VIDEO_ID is a members-only video, a 403 forbidden error is responded.

{"error": {"code": 403,"message": "One or more of the requested comment threads cannot be retrieved due to insufficient permissions. The request might not be properly authorized.","errors": [      {"message": "One or more of the requested comment threads cannot be retrieved due to insufficient permissions. The request might not be properly authorized.","domain": "youtube.commentThread","reason": "forbidden","location": "id","locationType": "parameter"      }    ]  }}

Use OAuth Access Token

I issued an OAuth 2.0 Client Information from the Google Cloud Console and accessed the following URL.

Using the CODE obtained as the response, I made the following POST request.

<form action="https://oauth2.googleapis.com/token" method="post"><ul><li><input type="text" name="client_id" value="OAUTH_CLIENT_ID"></li><li><input type="text" name="client_secret" value="OAUTH_CLIENT_SECRET"></li><li><input type="text" name="redirect_uri" value="REDIRECT_URI"></li><li><input type="text" name="code" value="THE_CODE"></li><li><input type="text" name="grant_type" value="authorization_code"></li><li><button type="submit">submit</button></li></ul></form>

Using the ACCESS_TOKEN obtained as the response, I made the following GET request.

  • curl -H 'Authorization: Bearer OAUTH_ACCESS_TOKEN''https://youtube.googleapis.com/youtube/v3/commentThreads?part=snippet&videoId=VIDEO_ID'

If the VIDEO_ID is a public video, I can get comments. But if VIDEO_ID is a members-only video, a 403 forbidden error is responded.

Questions

  • (Q1) Is there a way to get comments on members-only videos (membership user of the channel only videos) from the YouTube API?
  • (Q2) Why is a 403 forbidden returned? Is there anything wrong with my above steps?
  • (Q3) Can you give me any advice for about what I want to do?

I asked this question because I could not find any information explaining how to use the YouTube API to make requests for “member-only videos”. It would be helpful to know if I am wrong or if it is impossible in the first place.


Viewing all articles
Browse latest Browse all 3638

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>