Overview
The platforms module provides live status checking for Kick, Twitch, YouTube, Rumble, and TikTok streamers.
import {
getChecker ,
getPlatformConfig ,
isPlatformSupported ,
checkKickLive ,
checkTwitchLive ,
checkYouTubeLive ,
checkRumbleLive ,
checkTikTokLive ,
} from './platforms/index.js' ;
getChecker()
Get the checker function for a specific platform.
import { getChecker } from './platforms/index.js' ;
const checker = getChecker ( 'twitch' );
const status = await checker ( 'xqc' );
Signature:
function getChecker ( platform : Platform ) : PlatformChecker
Platform name: "kick", "twitch", "youtube", "rumble", or "tiktok"
Function that accepts a username and returns a Promise of LiveStatus.
Get full configuration for a platform including name, color, emoji, and checker.
const config = getPlatformConfig ( 'kick' );
console . log ( config . name ); // "Kick"
console . log ( config . emoji ); // "🟢"
Signature:
function getPlatformConfig ( platform : Platform ) : PlatformConfig
Platform name to get config for.
Platform configuration object. Show PlatformConfig properties
Display name (e.g., “Twitch”, “YouTube”)
Embed color as hex number (e.g., 0x9146FF for Twitch purple)
Platform emoji for UI display
URL template with {username} placeholder
The platform’s live status checker function
Type guard to check if a string is a supported platform.
const userInput = 'twitch' ;
if ( isPlatformSupported ( userInput )) {
// userInput is now typed as Platform
const checker = getChecker ( userInput );
}
Signature:
function isPlatformSupported ( platform : string ) : platform is Platform
true if the platform is supported, false otherwise.
All platform checkers follow the same signature:
type PlatformChecker = ( username : string ) => Promise < LiveStatus >
checkKickLive()
Check if a Kick streamer is live via the Kick API v2.
import { checkKickLive } from './platforms/kick.js' ;
const status = await checkKickLive ( 'trainwreckstv' );
if ( status . isLive ) {
console . log ( ` ${ status . username } is live: ${ status . title } ` );
}
Signature:
async function checkKickLive ( username : string ) : Promise < LiveStatus >
Kick username (case-insensitive)
API Endpoint: https://kick.com/api/v2/channels/{username}
Returns:
Whether the streamer is currently live
Stream URL (e.g., https://kick.com/trainwreckstv)
Stream title/session title (only when live)
Current viewer count (only when live)
Whether the channel is verified
Game/category name (only when live)
Category banner image URL
Whether stream is marked as mature
Error message if check failed
Example:
const status = await checkKickLive ( 'trainwreckstv' );
if ( status . error ) {
console . error ( `Error: ${ status . error } ` );
} else if ( status . isLive ) {
console . log ( `Live: ${ status . title } ` );
console . log ( `Viewers: ${ status . viewers } ` );
console . log ( `Category: ${ status . category } ` );
} else {
console . log ( 'Not currently live' );
}
checkTwitchLive()
Check if a Twitch streamer is live via the Twitch GraphQL API.
import { checkTwitchLive } from './platforms/twitch.js' ;
const status = await checkTwitchLive ( 'xqc' );
Signature:
async function checkTwitchLive ( username : string ) : Promise < LiveStatus >
Twitch username (case-insensitive)
API Endpoint: https://gql.twitch.tv/gql
Returns: Same LiveStatus structure as Kick, with platform set to "twitch"
Additional Fields:
verified: true for Twitch Partners
bio: User’s channel description
category: Game name
categoryIcon: Game box art URL (144x192)
thumbnail: Stream preview image (640x360)
Example:
const status = await checkTwitchLive ( 'xqc' );
if ( status . isLive ) {
console . log ( ` ${ status . username } is live!` );
console . log ( `Title: ${ status . title } ` );
console . log ( `Game: ${ status . category } ` );
console . log ( `Viewers: ${ status . viewers ?. toLocaleString () } ` );
console . log ( `Partner: ${ status . verified } ` );
}
checkYouTubeLive()
Check if a YouTube channel is live by parsing the /live page.
import { checkYouTubeLive } from './platforms/youtube.js' ;
const status = await checkYouTubeLive ( 'ludwig' );
Signature:
async function checkYouTubeLive ( username : string ) : Promise < LiveStatus >
YouTube channel handle (without @ symbol)
Fetches: https://www.youtube.com/@{username}/live
Returns: Same LiveStatus structure with platform set to "youtube"
Notes:
Automatically redirects to active stream if live
Parses ytInitialData from page HTML
Extracts video ID for thumbnail generation
Returns subscriber count as followers
Example:
const status = await checkYouTubeLive ( 'ludwig' );
if ( status . isLive ) {
console . log ( ` ${ status . username } is streaming!` );
console . log ( `Title: ${ status . title } ` );
console . log ( `Watching: ${ status . viewers } ` );
console . log ( `Subscribers: ${ status . followers ?. toLocaleString () } ` );
console . log ( `Thumbnail: ${ status . thumbnail } ` );
}
checkRumbleLive()
Check if a Rumble streamer is live via HTML scraping.
import { checkRumbleLive } from './platforms/rumble.js' ;
const status = await checkRumbleLive ( 'TimPool' );
Signature:
async function checkRumbleLive ( username : string ) : Promise < LiveStatus >
Fetches: https://rumble.com/c/{username}
Returns: Same LiveStatus structure with platform set to "rumble"
Detection:
Checks for videostream__status--live or thumbnail__thumb--live classes
Extracts viewer count from videostream__views-ppv badge
Parses follower count from page header
Example:
const status = await checkRumbleLive ( 'TimPool' );
if ( status . isLive ) {
console . log ( `Live on Rumble: ${ status . title } ` );
console . log ( `Viewers: ${ status . viewers } ` );
console . log ( `Verified: ${ status . verified } ` );
}
checkTikTokLive()
Check if a TikTok user is live by parsing SIGI_STATE data.
import { checkTikTokLive } from './platforms/tiktok.js' ;
const status = await checkTikTokLive ( 'username' );
Signature:
async function checkTikTokLive ( username : string ) : Promise < LiveStatus >
TikTok username (without @ symbol)
Fetches: https://www.tiktok.com/@{username}/live
Returns: Same LiveStatus structure with platform set to "tiktok"
Detection:
Extracts SIGI_STATE JSON from script tag
Checks liveRoom.status === 2 for live status
Returns follower count and profile data even when offline
Example:
const status = await checkTikTokLive ( 'someuser' );
if ( status . isLive ) {
console . log ( ` ${ status . username } is live on TikTok!` );
console . log ( `Title: ${ status . title } ` );
console . log ( `Viewers: ${ status . viewers } ` );
console . log ( `Followers: ${ status . followers ?. toLocaleString () } ` );
}
The checker registry is exported as:
export const platformCheckers : Record < Platform , PlatformChecker > = {
kick: checkKickLive ,
twitch: checkTwitchLive ,
youtube: checkYouTubeLive ,
rumble: checkRumbleLive ,
tiktok: checkTikTokLive ,
};
Error Handling
All checkers handle errors gracefully:
const status = await checkTwitchLive ( 'invalid_user' );
if ( status . error ) {
console . error ( `Check failed: ${ status . error } ` );
// Status will have isLive: false and basic info
}
Error scenarios:
User not found: Returns isLive: false with no error
Network errors: Returns isLive: false with error field
API errors: Returns isLive: false with error message
HTTP 404: Returns isLive: false with no error