How can I get all my subscribed channel using youtube api v3 - youtube

I'm new to youtube api v3, and I have a problem when get all my subscribed channel. I've subscribed 65 channel but I can only get 50 each api call. So, Is there any way to get all?
Another thing is, I have a channelID, is there any api to check this channel in a list of my subscribed channel?

Youtube API restricts 50 results per call. In case you were asking whether you can get all 65 in the same call, then the answer is no. However, if you meant whether all 65 can be retrieved then, yes. You'll need to use the nextPageToken paramter value and pass it to the pageToken parameter which will take you to the next page. In code, it can be handled in the following way(as shown in the documentation):
var nextPageToken = '';
// This loop retrieves a set of playlist items and checks the nextPageToken
// in the response to determine whether the list contains additional items.
// It repeats that process until it has retrieved all of the items in the list.
while (nextPageToken != null) {
var playlistResponse = YouTube.PlaylistItems.list('snippet', {
playlistId: playlistId,
maxResults: 25,
pageToken: nextPageToken
});
Regarding your ChannelID problem, from your description I understand you want to check whether you are subscribed to a particular channel in case you have it's ID. I believe the Activities method of Youtube API should be able to help you out. Look at contentDetails.subscription property. I hope that resolves your problem.

Related

How to get all in-progress rooms with their participants in one HTTP request?

For performance reasons, I need to get all rooms together with their participants in only one HTTP request. Is that supported by Twilio REST API Client?
You can use the Twilio Room Resource API to get the list of Rooms based on there status.
Below is the Code in C# which returns a list of Room resources created in the given account. The list also includes paging information. Status Can be: in-progress (default) or completed
// Find your Account Sid and Token at twilio.com/console
TwilioClient.Init(accountSid, authToken);
var rooms = RoomResource.Read(
status: RoomResource.RoomStatusEnum.Completed,
limit: 20
);
Let me know if it helps!

how to get youtube live api stream key

How can I bind my YouTube stream key to match previous video.
I'm trying to use java to do it but getting no where.
I'm looking at the example given to create the broadcast stream but it doesn't have the keeping same key.
I've gotten help on this before. Please try do some research on Google and then ask the question. You can see How can I change the stream my event uses via the YouTube live api?. Which will help you as it did me.
In short this was the code i received for help.
Credit to #M. Prokhorov
YouTube yt = ... // your reference to YouTube
String broadcastId = ... // your broadcast Id
String newStreamId = ... // identifier of stream you want to bind
String apiKEy = ... // your API key
// you can define other response parts if you want more or don't want some of these
String responseParts = "id,status,contentDetails.boundStreamId";
yt.liveBroadcasts().bind(broadcastId, responseParts)
.setApiKey(apiKey)
.setStreamId(streamId)
// other data you might want in request
.execute()

Twilio - channel descriptor paginator order

I want to retrieve the list of channels for a user containing unread messages. The best solution I have found so far (please correct me if I'm wrong) is using channel descriptors.
// Example for a single page
client.getUserChannelDescriptors().then(function(paginator) {
for (var i = 0; i < paginator.items.length; i++) {
var descriptor = paginator.items[i].descriptor;
if (descriptor.unread_messages_count > 0) {
console.log("Channel found, id: " + descriptor.uniqueName);
}
}
});
My question: is there a way to order in the paginator object so I could retrieve channels with unread messages first so I wouldn't have to go through the whole list of channels?
Twilio developer evangelist here.
You can sort channels, but not with getUserChannelDescriptors. Instead, you need to make sure you've loaded all the subscribed channels and then you can sort them with getLocalChannels.
From the docs:
getLocalChannels( [sortingOptions])
Get array of Channels locally known to Client in provided sorting order. Locally known channels are the ones created and/or joined during client runtime and currently logged in User subscribed Channels. To ensure full list of subscribed Channels fetched - call the Client#getSubscribedChannels method and fetch all pages with help of Paginator#nextPage method.
The sorting options then allow you to sort by lastmessage.

Twilio Chat getChannels order by most recent message

In twilio chat, is there a way to specify an order to the getChannels() method? Or is there a property on the Channel object that will tell me when the last message sent on that channel was? The dateUpdated property on Channel seems to be when properties on the channel were updated, not including messages sent/received.
I would like to order my channels list by the most recent messages. And I would like to do this without having to retrieve all the messages first.
You can add the attributes parameter upon updating a channel.
An optional string metadata field you can use to store any data you
wish.
You could track time/date info of messages here.
# Update the channel
service = client.services.get(sid="CHANNEL_SID")
channel = service.channels.create()
response = channel.update(friendly_name="NEW_FRIENDLY_NAME", attributes="ANY_DATA_YOU_WISH")
print(response)
You should then be able to subscribe to a channel event (JavaScript SDK example). As you did not specify what language you're using you will also find more details in the API Docs for iOS and Android SDKs as well.
// A channel's attributes or metadata have changed.
messagingClient.on('channelUpdated', function(channel) {
console.log('Channel updates: ' + channel.sid);
});

Youtube api v3 for get Channel's videos

I am trying to get channel's videos using,
https://www.googleapis.com/youtube/v3/search?order=date&part=snippet&channelId=UC6-F5tO8uklgE9Zy8IvbdFw&type=video&maxResults=50&key={YOUR_API_KEY}
It is working. Now i want show channel video for that i am using show channel id in this api like,
https://www.googleapis.com/youtube/v3/search?order=date&part=snippet&channelId=SW0ORvMZrxEHM&type=video&maxResults=50&key={YOUR_API_KEY}
but it returns whole search result. I want only that shows videos.
Can anyone facing same issue?
The channelId "SWfds0ORvMZrxEHM" is an invalid ChannelId with an invalid ChannelId format. As you can see, the first's request ChannelId starts with UC, like each valid channelId has to (there are some exceptions, but channelIds always starts with a two letter code).
If you replace the channelId of the second request with any other random string, you always get totalResults: 1000000
If you replace the channelId with a string that starts with "UC[random string]" you will get totalResults: 0

Resources