From 491146bef242a4bcc4e2e0ae1ab9abbc2d7ad1e4 Mon Sep 17 00:00:00 2001 From: jainefer Date: Sat, 17 Feb 2024 16:22:02 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20=EC=98=81=EC=83=81=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EB=B9=88=EA=B0=92=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 11 +++++++++-- package.json | 3 ++- src/controllers/summary.controller.js | 15 +++++++++------ src/services/video.service.js | 4 ++-- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 74ee942..88df814 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "express-session": "^1.17.3", "ffmpeg": "^0.0.4", "fluent-ffmpeg": "^2.1.2", - "get-youtube-title": "^1.0.1", + "get-youtube-title-await": "^1.1.5", "http-status-codes": "^2.3.0", "install": "^0.13.0", "jsonwebtoken": "^9.0.2", @@ -46,6 +46,7 @@ "@babel/preset-env": "^7.23.7", "babel-cli": "^6.26.0", "babel-loader": "^9.1.3", + "get-youtube-title": "^1.0.1", "nodemon": "^3.0.2", "swagger": "^0.7.5", "webpack": "^5.89.0", @@ -6144,7 +6145,13 @@ "node_modules/get-youtube-title": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/get-youtube-title/-/get-youtube-title-1.0.1.tgz", - "integrity": "sha512-UtaDf69QDkLoSRpUazUC420QlcG59+VmzIjZUqPn2aW5LB99C3c8OLIlDQy7kKAeqIhp/K/ZVDcscDF6K1MJ+Q==" + "integrity": "sha512-UtaDf69QDkLoSRpUazUC420QlcG59+VmzIjZUqPn2aW5LB99C3c8OLIlDQy7kKAeqIhp/K/ZVDcscDF6K1MJ+Q==", + "dev": true + }, + "node_modules/get-youtube-title-await": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/get-youtube-title-await/-/get-youtube-title-await-1.1.5.tgz", + "integrity": "sha512-kegsz6qLYlRjBlJHVJIl+Eh/fBi0rtpQ98RquJuftx9UuZTqW3n/6Zout9KM6wEP6uvDcSLiy35RP3xhPO0lxw==" }, "node_modules/glob": { "version": "7.2.3", diff --git a/package.json b/package.json index 935553f..8188d06 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "express-session": "^1.17.3", "ffmpeg": "^0.0.4", "fluent-ffmpeg": "^2.1.2", - "get-youtube-title": "^1.0.1", + "get-youtube-title-await": "^1.1.5", "http-status-codes": "^2.3.0", "install": "^0.13.0", "jsonwebtoken": "^9.0.2", @@ -50,6 +50,7 @@ "@babel/preset-env": "^7.23.7", "babel-cli": "^6.26.0", "babel-loader": "^9.1.3", + "get-youtube-title": "^1.0.1", "nodemon": "^3.0.2", "swagger": "^0.7.5", "webpack": "^5.89.0", diff --git a/src/controllers/summary.controller.js b/src/controllers/summary.controller.js index 290e652..835ae39 100644 --- a/src/controllers/summary.controller.js +++ b/src/controllers/summary.controller.js @@ -8,6 +8,7 @@ import { readFileFromObjectStorage } from '../services/storage.service.js'; import { checkFileExistsInStorage } from '../services/storage.service.js'; import { getScriptFileName } from '../services/storage.service.js'; import { chatGPTCall } from '../services/chatGPT.service.js'; + import getYoutubeTitle from 'get-youtube-title'; export const processVideo = async (req, res) => { @@ -26,12 +27,14 @@ export const processVideo = async (req, res) => { const id =videoId; console.log("id",id); - let videoTitle=""; - - getYoutubeTitle(videoId,async function(err,title){ - videoTitle=title; - }) - + + let videoTitle="" + const titleData=await getYoutubeTitle(id, async function (err, title) { + console.log("타이틀",title); + return title; // 'SLCHLD - EMOTIONS (feat. RIPELY) (prod. by GILLA)' + }) + + console.log("비디오 테그",titleData); // const clientId = token; // Object Storage에서 해당 MP3 파일이 존재하는지 확인 diff --git a/src/services/video.service.js b/src/services/video.service.js index 6018db2..7dfd6cc 100644 --- a/src/services/video.service.js +++ b/src/services/video.service.js @@ -63,7 +63,7 @@ export const viewSimpleVideo=async(data)=>{ } catch (error) { console.error(error); - throw new BaseError(status.VIDEO_NOT_FOUND); + return {"videos":[]} } } @@ -121,7 +121,7 @@ export const viewCategoryVideo=async(data)=>{ return getCategoryVideoResponseDTO(getVideoData,tagData); } catch (error) { console.error(error); - throw new BaseError(status.CATEGORY_IS_EMPTY); + return {"videos":[]} } } async function findCategory(categoryData, category, user) {