For Twitter, you can look up the user at read the followers count from the FollowersCount property on the user object.
Facebook has a /me/subscribers method, but according to their upgrade guide to version 2.0 of the Facebook API, the method has been removed. However it still seems to be working when I do a test. I don't know of any other ways to get the subscribers count. If you manage to find something in the API documentation, I'd be happy to add it to Skybrud.Social.
I haven't yet focused on users in the YouTube API, so I don't know what is possible there.
int followers = service.Users.GetUser("abjerner").FollowersCount;
For YouTube
Version 2 of the Google API allows you to get the subscriber count for a given user, but that version was deprecated in the spring.
Version 3 doesn't work with users, but channels instead. Considering that you have an active instance of GoogleService and sufficient permissions to access the YouTube API, you can do the following:
It is only a quick snippet - I will add better support for it later in Skybrud.Social. The snippet also lacks error handling , and it is only tested with a user that has a single channel.
For Facebook
As I wrote earlier, this seems to be deprecated as of v2.0, but it still works. You can exchange me with a valid identifier.
string res = SocialUtils.DoHttpGetRequestAndGetBodyAsString("https://graph.facebook.com/v2.2/me/subscribers?access_token=" + service.Client.AccessToken);
dynamic json = JsonConvert.DeserializeObject<JObject>(res);
int subscriberCount = json.summary.total_count;
Social followers
For youtube / twitter and facebook is it possible via api to get follower counts for given account or do we have to extend to do that?
Cheers
Ismail
Hi Ismail,
For Twitter, you can look up the user at read the followers count from the
FollowersCount
property on the user object.Facebook has a
/me/subscribers
method, but according to their upgrade guide to version 2.0 of the Facebook API, the method has been removed. However it still seems to be working when I do a test. I don't know of any other ways to get the subscribers count. If you manage to find something in the API documentation, I'd be happy to add it to Skybrud.Social.I haven't yet focused on users in the YouTube API, so I don't know what is possible there.
For Twitter
For YouTube
Version 2 of the Google API allows you to get the subscriber count for a given user, but that version was deprecated in the spring.
Version 3 doesn't work with users, but channels instead. Considering that you have an active instance of
GoogleService
and sufficient permissions to access the YouTube API, you can do the following:It is only a quick snippet - I will add better support for it later in Skybrud.Social. The snippet also lacks error handling , and it is only tested with a user that has a single channel.
For Facebook
As I wrote earlier, this seems to be deprecated as of v2.0, but it still works. You can exchange
me
with a valid identifier.Anders,
Awesome will give a whirl timmorow.
Regards
Ismail
Anders,
Got the twitter user followers working nicely, love this library its going to save some time h5yr!!!
Regards
Ismail
is working on a reply...