Last active
September 2, 2025 16:44
-
-
Save JacobWeisenburger/f43f4635be7bfb8328823103bfaf3e5f to your computer and use it in GitHub Desktop.
checkIfYouTubeChannelIsLive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| CORS blocks this request from the browser, so you will need to run this code on the server. | |
| */ | |
| async function checkIfYouTubeChannelIsLive ( channelId: string ) { | |
| const liveCheckURL = `https://www.youtube.com/embed/live_stream?channel=${ channelId }` | |
| const responseText = await fetch( liveCheckURL ).then( res => res.text() ) | |
| const isLive = responseText.indexOf( 'This video is unavailable' ) < 0 | |
| return isLive | |
| } |
Author
you're welcome. Just curious, how did you find this?
Stackoverflow I believe, its been a blur to be honest haha, I've been doing scrapping and stuff to do this until I finally found your answer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This worked wonderfully, thank you @JacobWeisenburger !