From ce94673981e6991c3c75632cd7d725e9ca166f3f Mon Sep 17 00:00:00 2001 From: "sungjin.choi" Date: Fri, 29 May 2026 10:28:43 +0900 Subject: [PATCH] =?UTF-8?q?chore=20:=20=EB=B2=A0=EB=84=88=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 1 + src/views/Main.vue | 41 +++++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 20 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..1216493 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +VITE_YOUTUBE_API_KEY=AIzaSyCMrcXrsvmXf3D88a6RlLAUetErOx1PxGc \ No newline at end of file diff --git a/src/views/Main.vue b/src/views/Main.vue index 1bbab08..4ad4dbe 100644 --- a/src/views/Main.vue +++ b/src/views/Main.vue @@ -261,35 +261,36 @@ const triggerOverlayProcess = (durationMs, initialMsg) => { }, stepTime); }; -const apiKey = 'AIzaSyD51LHwqoY8spjq6rsY_RlhBXzb96j7D6o'; +const apiKey = import.meta.env.VITE_YOUTUBE_API_KEY; const channelId = 'UC8L92ju0V88s6TcmLPb8Bkg'; const maxResults = 8; const apiUrl = `https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=${channelId}&maxResults=${maxResults}&order=date&type=video&key=${apiKey}`; const fetchVideos = async () => { try { - const res = await axios.get(apiUrl); - if (res.data && res.data.items && res.data.items.length > 0) { - videos.value = res.data.items; + // ๐Ÿ’ก ์œ ํŠœ๋ธŒ ๊ทœ์น™์ƒ ์ฑ„๋„ ID์˜ ์•ž ๊ธ€์ž 'UC'๋ฅผ 'UU'๋กœ ๋ฐ”๊พธ๋ฉด + // ํ•ด๋‹น ์ฑ„๋„์˜ '์ „์ฒด ์—…๋กœ๋“œ ์˜์ƒ ํ”Œ๋ ˆ์ด๋ฆฌ์ŠคํŠธ' ID๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. (๋น„์šฉ 100์œ ๋‹› -> 1์œ ๋‹›์œผ๋กœ ๋‹จ์ถ•) + const uploadPlaylistId = channelId.replace(/^UC/, 'UU'); + const playlistApiUrl = `https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=${uploadPlaylistId}&maxResults=${maxResults}&key=${apiKey}`; + + const res = await axios.get(playlistApiUrl); + + // ๐ŸŒŸ [๋งคํ•‘ ๋งค์ง] ์œ ์ €๋‹˜์ด ์งœ๋‘์‹  ๊ธฐ์กด