Toggle navigation
Toggle navigation
This project
Loading...
Sign in
곽윤철
/
youtube-comment-seperator
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Yuncheol Kwak
2022-06-01 15:28:54 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f2bf782c22d04275625e017a4f91f7a58a4bb7e1
f2bf782c
1 parent
002986e3
Feat modified design
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
16 deletions
CommentLoadingTest.js
CommentLoadingTest.js
View file @
f2bf782
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>
...
...
@@ -151,7 +154,7 @@ var app = http.createServer(function(request,response){ // request는 브라우
</div>
</form>
</body>
</html>
</html>
`
;
response
.
writeHead
(
200
);
response
.
end
(
body
);
...
...
Please
register
or
login
to post a comment