From 64f0d2746885fc2e33b0b98986fe49a2eaf3753c Mon Sep 17 00:00:00 2001 From: Dongho Kim Date: Mon, 22 Jun 2026 03:00:30 +0200 Subject: [PATCH] update --- .env | 5 +++++ index.js | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.env b/.env index 10abb01..be0bfab 100644 --- a/.env +++ b/.env @@ -3,3 +3,8 @@ PORT=3000 # Format: CHANNELS=id1:Name1,id2:Name2 # You can find the channel ID in the URL of the streamer's Chzzk channel (e.g., chzzk.naver.com/CHANNEL_ID) CHANNELS=4df4756104a54e28e967bff6dc08e319:KBS2,8ecd602c251f30fd7f09463e9f55609f:JTBC + +# Optional: Add your Naver login cookies to access 1080p and adult streams. +# To get these, log in to Chzzk/Naver in your browser, open Developer Tools -> Application -> Cookies. +# NID_AUT= +# NID_SES= diff --git a/index.js b/index.js index f61a70d..2b86ca5 100644 --- a/index.js +++ b/index.js @@ -37,10 +37,19 @@ app.get('/stream/:channelId', async (req, res) => { const { channelId } = req.params; try { + const headers = { + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' + }; + + const cookies = []; + if (process.env.NID_AUT) cookies.push(`NID_AUT=${process.env.NID_AUT}`); + if (process.env.NID_SES) cookies.push(`NID_SES=${process.env.NID_SES}`); + if (cookies.length > 0) { + headers['Cookie'] = cookies.join('; '); + } + const response = await axios.get(`https://api.chzzk.naver.com/service/v3/channels/${channelId}/live-detail`, { - headers: { - 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' - } + headers }); const data = response.data;