Yuncheol Kwak

Feat modified design

const http = require('http');
const fs = require('fs');
const url = require('url');
const testFolder = './data';
const qs = require('querystring');
const path = require('path');
var papago = require("./papago.js");
var http = require('http');
var fs = require('fs');
var url = require('url');
var testFolder = './data';
var qs = require('querystring');
var path = require('path');
const {google} = require("googleapis");
const service = google.youtube('v3');
const apiKey = 'AIzaSyCjBrFKnBlGvxsfOD-qJP8nBkdEoqKRHu8'; //api키
let videoNum = "TpPwI_Lo0YY"; //비디오 주소(예시)
const serverIP = "http://localhost:3000" //서버의 주소
var commentList = new Array();
var commentNum = 0;
var savednpt = ''
......@@ -34,10 +36,10 @@ function showcomment(response, VideoNum){
<link href="https://fonts.googleapis.com/css2?family=Ubuntu&display=swap" rel="stylesheet">
</head>
<body style="margin:5%">
<h1 style="font-family: 'Permanent Marker', cursive; text-align:center; padding-bottom:1%;">Youtube Comment Seperator</h1>
<form action="http://localhost:3000/search" method="get">
<h1 style="font-family: 'Permanent Marker', cursive; text-align:center; padding-bottom:1%;"><a href="${serverIP}" style="text-decoration:none; color:inherit;">Youtube Comment Seperator</a></h1>
<form action="${serverIP}/search" method="get">
<div class="form-group" style="font-family: 'Ubuntu', sans-serif;">
<input type="text" name="videourl" placeholder="Type in video ID" class="form-control" style="margin-bottom:10px;">
<input type="text" name="videourl" placeholder="Type in video Url" class="form-control" style="margin-bottom:10px;">
<label for="language-select">Choose a language:</label>
<select class="form-control" name="languages" id="language-select" style="display:inline-flex;">
<option value="all" selected>--Please choose an option--</option>
......@@ -60,9 +62,8 @@ function showcomment(response, VideoNum){
<iframe class="embed-responsive-item" width="560" height="315" src="https://www.youtube.com/embed/${VideoNum}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<br>
<a class="btn btn-dark" href="http://localhost:3000/search?videourl=${VideoNum}&nextpage=${savednpt}" role="button">Show more comments</a>
<a class="btn btn-dark" href="${serverIP}/search?videourl=${VideoNum}&nextpage=${savednpt}" role="button">Show more comments</a>
<br>
<div id="results"></div>
${commentDisplay}
</body>
</html>
......@@ -83,10 +84,12 @@ function loadcomment(ApiKey, VideoNum, npt, n, res){
}).then(function(response) {
//console.log("Response", response);
for(let iter = 0; iter < response.data.pageInfo.totalResults; iter++){
let templang = papago.getLang(response.data.items[iter].snippet.topLevelComment.snippet.textDisplay)
let tempComment = {
'name' : response.data.items[iter].snippet.topLevelComment.snippet.authorDisplayName,
'image' : response.data.items[iter].snippet.topLevelComment.snippet.authorProfileImageUrl,
'text' : response.data.items[iter].snippet.topLevelComment.snippet.textDisplay
'text' : response.data.items[iter].snippet.topLevelComment.snippet.textDisplay,
'lang' : templang
}
commentList.push(tempComment);
commentNum += 1;
......@@ -130,10 +133,10 @@ var app = http.createServer(function(request,response){ // request는 브라우
<link href="https://fonts.googleapis.com/css2?family=Ubuntu&display=swap" rel="stylesheet">
</head>
<body style="margin:5%">
<h1 style="font-family: 'Permanent Marker', cursive; text-align:center; padding-bottom:1%;">Youtube Comment Seperator</h1>
<form action="http://localhost:3000/search" method="get">
<h1 style="font-family: 'Permanent Marker', cursive; text-align:center; padding-bottom:1%;"><a href="${serverIP}" style="text-decoration:none; color:inherit;">Youtube Comment Seperator</a></h1>
<form action="${serverIP}/search" method="get">
<div class="form-group" style="font-family: 'Ubuntu', sans-serif;">
<input type="text" name="videourl" placeholder="Type in video ID" class="form-control" style="margin-bottom:10px;">
<input type="text" name="videourl" placeholder="Type in video Url" class="form-control" style="margin-bottom:10px;">
<label for="language-select">Choose a language:</label>
<select class="form-control" name="languages" id="language-select" style="display:inline-flex;">
<option value="all" selected>--Please choose an option--</option>
......