Is there a way to get historical youtube subscriber information? - youtube-api

Currently I am retrieving daily subscriber information with the following request:
var videoOptions = {
'part': 'snippet,contentDetails,statistics',
'id': videoIds
};
// Send request
youtube.videos.list(videoOptions, (err, videoDetails) => {});
My question is there a way to get historical subscriber information either through the Data API or Analytics API?
I see there is a way to see subs gained or lost over a period of time but I don't know what the base is to compare against:
https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3D{channelID}&start-date=2017-07-31&end-date=2017-08-01&&metrics=subscribersLost%2CsubscribersGained

There is currently no way to retrieve the historical number of subscribers in the past. The only way you can track your subscriber change is to perform channels.list, setting mySubscribers property to true and do it the next day. No method to check for history. This is also confirmed in this SO post.

Depending on how large your subscriber base is, you could try checking the list of when users started subscribing at https://www.youtube.com/subscribers
Perhaps this can offer some insight, and the number of rows/users returned can be counted to give an indication of historical activity.

Related

Twilio conversation JS SDK - a proper way of fetching user conversations

I'm trying to display all user's conversations sorted by last message creation date and I'm a little bit confused.
I see getSubscribedConversation method in docs (https://media.twiliocdn.com/sdk/js/conversations/releases/1.1.0/docs/Client.html#getSubscribedConversations__anchor) but it says nothing about page size and sorting. It returns paginator so I assume it doesn't return all conversations at once.
On the other hand I see some examples in twilio github projects where conversations are added to the list only by listening for conversationAdded event (which indeed fires even for previously created conversations) but it doesn't seem like a clean solution - if user belongs to 50 conversation then I should handle every single event and rerender the list 50 times?
To sum up, I have following questions:
Does getSubscribedConversation returns all user's conversations at once?
If no, then what is default page size and is it possible to change it (together with sorting)
If getSubscribedConversation return paginator indeed - wouldn't it break if I add conversation from conversationAdded event in the meantime?
I can't answer all your questions but I can give some insight on a couple -
From what I can tell, getSubscribedConversations returns 50 Conversations. I have not found a way to change that limit or sort it (I'm not entirely sure in what order Twilio returns them even).
For a project I'm working on we need Conversations sorted in order of recent message. The way I'm currently dealing with it is by storing the most recent message on an attribute on the Conversation. I also initialize the app by loading all the conversations with a recursive function.
Hope that sheds some light for you.

List channel subscriptions returns only my channel

So, I have a request that should list my subscribers who do not have the private subscriptions option enable. My request is:
response = youtube.subscriptions().list(
part="snippet",
maxResults=50,
mySubscribers=True
).execute()
However, in items resource, every channel returned is my own channel. My channel name, ID and profile images. Is this the problem with the API or am I making a wrong request?
I also tried using the Try this API option on the documentation, but it also returns the same result.
https://developers.google.com/youtube/v3/docs/subscriptions/list
Thank you for any help you can give
According to the official docs you already quoted, you should have passed to your API call the parameter part as:
part="snippet,subscriberSnippet".
The subscriberSnippet part gives you the needed info:
subscriberSnippet (object)
The subscriberSnippet object contains basic details about the subscriber.
For what concerns the snippet part, the official doc is indeed a bit ambiguous:
snippet (object)
The snippet object contains basic details about the subscription, including its title and the channel that the user subscribed to.
Nevertheless, the info you get from part="snippet" only is correct.

C# MsGraph-SDK: Send a BatchRequest to get manager links using Microsoft Graph SDK

First of all please share if there is any MSGraph SDK official documentation anywhere that I can use for reference.
I have a scenario, where I want to query all manager and member links from AAD without providing the user and group objectID respectively. This is currently supported in DQ channel, i.e. I can do something like this using MsGraphSDK:
MsGraphClient.Users.Delta().Request().Select("manager")
OR
MsGraphClient.Groups.Delta().Request().Select("members")
I don't want to use DQ for initial-sync due to performance problems, and other issues.
My fallback option is to query through Graph directly, so I want to do something like the following, but this doesn't return any result:
MsGraphClient.Users.Request().Select("manager")
OR
MsGraphClient.Groups.Request().Select("members")
It looks like this isn't even supported currently at the lower (AADGraph) layer. Please correct me if I am wrong, and provide a solution if any!
So my fallback approach is to pull all the user and group aadObjectIds, and explicitly query the manager and member links respectively.
In my case, there can potentially be 500K User-Objects in AAD, and I want to avoid making 500K separate GetManager calls to AAD. Instead, I want to batch the Graph requests as much as possible.
I wasn't able to find much help from the Internet on sending Batch requests through SDK.
Here's what I am doing:
I have this BatchRequestContent:
var batchRequestContent = new BatchRequestContent();
foreach (string aadObjectId in aadObjectIds)
{
batchRequestContent.AddBatchRequestStep(new BatchRequestStep(aadObjectId, Client.Users[aadObjectId].Manager.Request().GetHttpRequestMessage()));
}
and I am trying to send a BatchRequest through GraphSDK with this content to get a BatchResponse. Is this currently supported in SDK? If yes, then what's the procedure? Any documentation or example? How to read the batch-response back? Finally, is there any limit for the # of requests in a batch?
Thanks,
Here is a related post: $expand=manager does not expand manager
$expand is currently not supported on the manager and directReports relationships in the v1.0 endpoint. It is support in the beta endpoint but
the API returns way to much throw away information: https://graph.microsoft.com/beta/users?$expand=manager
The client library partially supports Batch at this time although we have a couple of pull requests to provide better support
with the next release (PR 1 and 2).
To use batch with the current library and your authenticated client, you'll do something like this:
var authProv = MsGraphClient.AuthenticationProvider;
var httpClient = GraphClientFactory.Create(authProv);
// Send batch request with BatchRequestContent.
HttpResponseMessage response = await httpClient.PostAsync("https://graph.microsoft.com/v1.0/$batch", batchRequestContent);
// Handle http responses using BatchResponseContent.
BatchResponseContent batchResponseContent = new BatchResponseContent(response);

What's the most efficient way to query Microsoft Graph events by id list?

Currently, in my code, I am taking a list of stored Event ids and fetching them like this:
results = await Task.WhenAll(
criteria.Identifiers
.Skip(offset).Take(pageSize)
.Select(i => userEvents[i].Request(options).GetAsync())
.ToList());
This works fine, but it makes pageSize number of calls to the API, which seems less than ideal. Is there a way to bundle these identifiers into a single API call?
My question proved similar to another:
Getting multiple users/groups by objectids
The answer, there, suggests this feature might be coming, but isn't here, yet. If anyone knows more about the timeline, please add another answer or comment.

tweet favorite count

Is there any api endpoint to retrieve the shares, favorites and retweets count about a link shared on twitter?
To get the comments, likes and shares count on fb I use the following endpoint:
https://api.facebook.com/method/links.getStats?urls=my_url
Is there any similar endpoint on twitter?
Right now I'm getting only the shared count with:
http://urls.api.twitter.com/1/urls/count.json?url=my_url
EDIT: this endpoint does not return the actual shared count, it's always 1.
Retweets: https://dev.twitter.com/rest/reference/get/statuses/retweets/%3Aid
Shares: Aren´t "Retweets" actually shares?
Favorites: I am not sure if it´s possible, there is no endpoint afaik
You can also use a platform like sharedcount though, a lot easier to handle and you get all the counts in one call - for all relevant platforms. That would be the best solution if you only want to get counts.
Take a look at the "Sources" section of their old docs to see how sharedcount gets the counts: http://www.sharedcount.com/documentation.php
Twitter: http://urls.api.twitter.com/1/urls/count.jsonurl=%%URL%%&callback=twttr.receiveCount

Resources