Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of subscribers (request) #5

Open
marcfon opened this issue Apr 11, 2017 · 5 comments
Open

List of subscribers (request) #5

marcfon opened this issue Apr 11, 2017 · 5 comments

Comments

@marcfon
Copy link

marcfon commented Apr 11, 2017

Would it be possible to add a the option to get the list of subscribers? The YouTube API seems to support the function.
https://developers.google.com/youtube/v3/docs/subscriptions/list

@witnessmenow
Copy link
Owner

Looks like it's possible ok. I am swamped for the next few weeks with other work but if somebody wanted to add it it shouldnt be too difficult.

First step would be to test the API on your computer to figure out how it works and make sure it's bringing back the data you want.

Second would be to modify the library, I would add another method like getChannelStatistics. Build up the url the same way that worked for you in the first step. The Json part will need to be changed as well to match the response from the API

That would be pretty much it. Sorry that I cant take it up at the moment

@joeybab3
Copy link
Contributor

Are you looking to get newly subscribed people? Because I feel like the list would quickly become too much for the arduino to handle especially for people with 1k+ subs

@marcfon
Copy link
Author

marcfon commented Apr 17, 2017

@witnessmenow I looked in the current code and it looks fairly easy to add the new function. I also played around with the YouTube API but got stuck on that one. I can't seem to return the subscribers in the order I want. Will need to do some more testing.

@joeybab3 Yeah I'm looking to get the latest subscribers. Not all of them. Can't figure out the right YouTube API call though. It seems to return the subscribers in random order instead of the date subscribed.

UPDATE
I think I've got it. The thing that makes it confusing is that the subscribers page of a channel (https://www.youtube.com/subscribers) is not real time and the API is. So the results of the API don't match with what you seen on the page. In my case there were more recent subscribers shown in the API results than there were displayed on the page. Eventually the code is really simple. You just need to set part = subscriberSnippet and myRecentSubscribers = true. This will return the 5 most recent subscribers to your channel. I'll try to add it to the codebase and do a pull request when it's ready.

@marcfon
Copy link
Author

marcfon commented Apr 17, 2017

I can't get it to work using the API key. I've managed to get it working using the OAuth access token but it takes a few additional steps to set this up. Would be nice if the API key would work.

UPDATE
Reading up on the API documentation it seems that OAuth is the only way to go in this case. Like I said I've got the basics running with OAuth but now need to figure out how to do a POST call to YouTube instead of the GET. More googling...

@marcfon
Copy link
Author

marcfon commented Apr 22, 2017

So it turned out to be quite a project to implement the recent subscribers function. The result is that I've forked the project and implemented OAuth2 support in the library. This basically opens up the way to support the whole YouTube API. I'm sure the my code can be further optimised but the basics work. You can find the code at https://github.com/marcfon/arduino-youtube-api

My fork breaks the (backwards) compatibility with the current code as I've fully removed the dependancy on the API key. So it's up to you how you'd like to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants