Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

338
Visualizações
Check if a Twitch Stream Is Live Using node js

I don't know how to combine them. I made a code by referring to the link below. Please Help me...

Android - Checking if a twitch stream is online

Is There Any Way To Check if a Twitch Stream Is Live Using Python?

setting

export const CHANNEL_NAME = ["daXXXXXX", "gmXXXXXXX"];
export const OAUTH_TOKEN = 'oauth:bn1rXXXXXXXXXXXXXXXXX';
export const CLIENT_ID = 'bxqtXXXXXXXXXXXXXXXXX';
export const BOT_USERNAME = 'gaXXXXt';

my code

async function test2() {
    var theUrl = `https://api.twitch.tv/kraken/streams/${CHANNEL_NAME[0]}`
    var headers = {
        "Client-ID": CLIENT_ID

    };
    fetch(theUrl, headers).then(data =>{
        console.log(data)
    })
  }
test2()

debug data

Response {
  size: 0,
  timeout: 0,
  [Symbol(Body internals)]: {
    body: PassThrough {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 5,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: true,
      [Symbol(kCapture)]: false,
      [Symbol(kCallback)]: null
    },
    disturbed: false,
    error: null
  },
  [Symbol(Response internals)]: {
    url: 'https://api.twitch.tv/kraken/streams/#daXXXXXX',
    status: 400,
    statusText: 'Bad Request',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
}
about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

The twitch kraken has been decommissioned, you need to use the helix api instead.

async function isStreamerLive(username) {
    const theUrl = `https://api.twitch.tv/helix/streams?user_login=${username}`
    const headers = {
        "Client-Id": CLIENT_ID,
        "Authorization": OAUTH_TOKEN
    };

    const response = await fetch(theUrl, headers);
    const data = await response.json();

    return data?.data?.find(s => s.user_login === username.toLocaleLowerCase())
  }
about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda