sparcut
sparcut

Reputation: 825

How do you get liveChatID without owner auth with YouTube Live API?

I am trying to get retrieve the live chat for a given youtube live stream, with the goal of moderation of chat (Which yes, will need mod auth).

Though at the moment, I'm working on just getting the chat, how can I get the liveChatId from liveBroadcasts/list using the broadcast id (which is just the video ID right?). Every resource I've found so far is doing this for their own chat, though I'd like to retrieve another user's.

Since the request requires authentication, I'm just using an account that is not the owner nor has mod powers.

When trying to retrieve a broadcasts snippet (atm), it retruns with code 200, but has no items.

e.g.

{
    kind: youtube#liveBroadCastListResponse,
    etag: "{string of random num & chars}",
    pageInfo: {
        totalResults: 0,
        resultsPerPage: 5
    },
    items: []
}


Edit - Example of request (Node.js)

/* auth = {oauth2 token credentials} | google = require('googleapis')
   eventID not used, hardcoded atm.
 */


function getEventDetails(auth, eventID) {
    let service = google.youtube('v3');

    service.liveBroadcasts.list({
        auth: auth,
        part: 'snippet',
        id: 'ChlYPack5Jc' // eventID
    }, (err, res) => {
        if(err) {
            return console.log('API returned error: ' + err);
        }

        console.log(res);
    });
}

Upvotes: 0

Views: 1262

Answers (1)

ReyAnthonyRenacia
ReyAnthonyRenacia

Reputation: 17613

If you're receiving a 200 ok response but empty response, try specifying the specific field parameters you want included in the result. You can find the list of fields here.

Upvotes: 0

Related Questions