Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

337
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!