7

I'm trying to use youtube api to get a list of subscribers to a channel i own then check a user's Email to find out if he's subscribed or not. Now I'm using this page to test my first step https://developers.google.com/youtube/v3/docs/subscriptions/list and inserting data as follows and all other fields are empty enter image description here

As you can see I get this error and the part label contains an error while the value is "snippet". how to solve this problem and if solved as I need is it available to get a list of all users' emails subscribed to my channel as a list?

Community
  • 1
  • 1
PHP User
  • 2,350
  • 6
  • 46
  • 87
  • 400 Bad Request - Show headers - { "error": { "errors": [ { "domain": "youtube.part", "reason": "unknownPart", "message": "subscriberSnippet", "locationType": "parameter", "location": "part" } ], "code": 400, "message": "subscriberSnippet" } } – Sakthivel Appavu Feb 26 '15 at 12:16

1 Answers1

14

get a list of subscribers to a channel i own

If you want check the subscribers of your YouTube channel you need to use the resource subscription.list with these fields:

part: subscriberSnippet
mySubscribers: true

And authenticate with OAuth2.0.

then check a user's Email

Email is a private information, you can get it only if the owner of the channel give you the permission.

Sufian
  • 6,405
  • 16
  • 66
  • 120
mpgn
  • 7,121
  • 9
  • 67
  • 100
  • Changed "part" to "subscriberSnippet" and got this error ""message": "Incompatible parameters specified in the request." and the "part" label color is red – PHP User Jan 28 '15 at 15:51
  • @Yasser remove mine to true and your channelId, just follow the fields i indicate in my answer – mpgn Jan 28 '15 at 16:03
  • But this gets users (emails are not included and returned only 4 members) of my channel when I send the request I want the user to enter his email Address then he/she will be redirected to a different page if he had subscribed already to my channel so I think the channel id should be passed – PHP User Jan 28 '15 at 16:16
  • And I'm the owner of the channel – PHP User Jan 28 '15 at 16:27
  • @Yasser this answer is correct, you'll not be able to get the user's email from the API. I think the only way to do what you want is to get the list of the channels that the user subscribes to (using oauth to authenticate the user and than setting 'mine' to true) and check if your channel appears in the list returned – Vinicius Braz Pinto Jan 28 '15 at 19:38
  • 1
    OK now the "part=subscriberSnippet" and "mine=true. I get my channel id only "channelId": "UCulLaeJUDZ8iJm2NrnnprOA" though I'm subscribed to 38 channels I don't see any other channel id – PHP User Jan 29 '15 at 09:28
  • Update: changed part to snippet and mine=true and I got all channels ids. Thanks for helping you can add this as an answer – PHP User Jan 29 '15 at 09:41
  • This is not working for me. Each time when I change value of "part", it throws error. I want to fetch list of email address of users who have subscribed my vhannel on Youtube channel. – Shrish Shrivastava Nov 14 '18 at 13:33
  • Is there more detail for "And authenticate with OAuth2.0."? Does that mean to enable options under Google OAuth 2.0? – ffejrekaburb Feb 01 '20 at 22:49
  • Using the API, I only can get the subscriber who set the subscription status public. And this option is set to private by default. So I only can get part of the subscribers, not all of them. – Charles May 06 '21 at 06:41