79394768

Date: 2025-01-28 18:00:21
Score: 3
Natty:
Report link

This seemed to work for me:

https://gist.github.com/JacobWeisenburger/f43f4635be7bfb8328823103bfaf3e5f

/**
CORS blocks this request from the browser, so you will need to run this code on the server.
*/
export async function checkIfYouTubeChannelIsLive ( channelId: string ) {
    const liveCheck = `https://www.youtube.com/embed/live_stream?channel=${ channelId }`
    const responseText = await fetch( liveCheck ).then( res => res.text() )
    const isLive = responseText.indexOf( 'This video is unavailable' ) < 0
    return isLive
}
Reasons:
  • Blacklisted phrase (1): youtube.com
  • Blacklisted phrase (1): This video
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Jacob Weisenburger