Merge branch 'develop' of http://khuhub.khu.ac.kr/2019102147/youtube-comment-seperator into develop
Showing
8 changed files
with
86 additions
and
98 deletions
1 | { | 1 | { |
2 | - "youtubeAPI" : "",//insert your youtube API key. | 2 | + "youtubeAPI" : "ENTER YOUR GOOGLE API KEY", |
3 | - "papagoClientID" : "", //insert your papago client ID. | 3 | + "papagoClientID" : "ENTER YOUR NAVER CLIENT ID", |
4 | - "papagoClientSecret":"" //insert your papago client secret. | 4 | + "papagoClientSecret":"ENTER YOUR NAVER CLIENT SECRET" |
5 | } | 5 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -14,14 +14,25 @@ var videoLang = 'all'; //설정 언어 | ... | @@ -14,14 +14,25 @@ var videoLang = 'all'; //설정 언어 |
14 | const serverIP = "http://localhost:3000" //서버의 주소 | 14 | const serverIP = "http://localhost:3000" //서버의 주소 |
15 | var commentList = new Array(); | 15 | var commentList = new Array(); |
16 | var commentNum = 0; | 16 | var commentNum = 0; |
17 | -var savednpt = '' | 17 | +var korNum = 0; |
18 | +var savednpt = ''; | ||
18 | const URLreg1 = new RegExp(/https?:\/\/youtu.be\//);//유튜브에서 제공하는 동영상 공유 기능을 사용하여 얻은 URL 형식 | 19 | const URLreg1 = new RegExp(/https?:\/\/youtu.be\//);//유튜브에서 제공하는 동영상 공유 기능을 사용하여 얻은 URL 형식 |
19 | const URLreg2 = new RegExp(/https?:\/\/www.youtube.com\//);//유튜브 주소를 그대로 넣었을 때 URL형식 | 20 | const URLreg2 = new RegExp(/https?:\/\/www.youtube.com\//);//유튜브 주소를 그대로 넣었을 때 URL형식 |
20 | 21 | ||
21 | function showcomment(response, VideoNum){ | 22 | function showcomment(response, VideoNum){ |
22 | - let commentDisplay = ''; | 23 | + let commentDisplay = ''; |
23 | for(let iterArr = 0; iterArr < commentNum; iterArr++){ | 24 | for(let iterArr = 0; iterArr < commentNum; iterArr++){ |
24 | - commentDisplay += `<br>${commentList[iterArr].name}<br>${commentList[iterArr].text}<br><br>`; | 25 | + commentDisplay += ` |
26 | + <div style="margin-top:15px; display:flex"> | ||
27 | + <div style="margin-right:10px"> | ||
28 | + <img class="rounded-circle" src="${commentList[iterArr].image}"> | ||
29 | + </div> | ||
30 | + <div> | ||
31 | + <b>${commentList[iterArr].name}</b> | ||
32 | + <p>${commentList[iterArr].text}</p> | ||
33 | + </div> | ||
34 | + </div> | ||
35 | + `; | ||
25 | } | 36 | } |
26 | let body = ` | 37 | let body = ` |
27 | <!doctype html> | 38 | <!doctype html> |
... | @@ -58,11 +69,13 @@ function showcomment(response, VideoNum){ | ... | @@ -58,11 +69,13 @@ function showcomment(response, VideoNum){ |
58 | </form> | 69 | </form> |
59 | <br> | 70 | <br> |
60 | <br> | 71 | <br> |
61 | - <div class="embed-responsive embed-responsive-16by9" style="text-align:center;"> | 72 | + <div class="embed-responsive embed-responsive-16by9" style="text-align:center"> |
62 | <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> | 73 | <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> |
63 | </div> | 74 | </div> |
64 | <br> | 75 | <br> |
76 | + <div id="liveAlertPlaceholder"></div> | ||
65 | <a class="btn btn-dark" href="${serverIP}/search?videourl=${VideoNum}&nextpage=${savednpt}&languages=${videoLang}" role="button">Show more comments</a> | 77 | <a class="btn btn-dark" href="${serverIP}/search?videourl=${VideoNum}&nextpage=${savednpt}&languages=${videoLang}" role="button">Show more comments</a> |
78 | + <button type="button" class="btn btn-danger" onclick="alert('Korean Percent: ${Math.floor((korNum/commentNum)*10000)/100}%')">Get Kor Percent</button> | ||
66 | <br> | 79 | <br> |
67 | ${commentDisplay} | 80 | ${commentDisplay} |
68 | </body> | 81 | </body> |
... | @@ -105,6 +118,7 @@ function loadcomment(ApiKey, VideoNum, npt, n, res){ | ... | @@ -105,6 +118,7 @@ function loadcomment(ApiKey, VideoNum, npt, n, res){ |
105 | templang = await langPromise; | 118 | templang = await langPromise; |
106 | if(videoLang == 'all' || videoLang == templang){ | 119 | if(videoLang == 'all' || videoLang == templang){ |
107 | commentList.push(tempcommentList[iter]); | 120 | commentList.push(tempcommentList[iter]); |
121 | + if(templang=="ko"){korNum++;} | ||
108 | commentNum++; | 122 | commentNum++; |
109 | } | 123 | } |
110 | } | 124 | } |
... | @@ -179,6 +193,7 @@ var app = http.createServer(function(request,response){ // request는 브라우 | ... | @@ -179,6 +193,7 @@ var app = http.createServer(function(request,response){ // request는 브라우 |
179 | else if(pathname === '/search'){ | 193 | else if(pathname === '/search'){ |
180 | commentList.splice(0); | 194 | commentList.splice(0); |
181 | commentNum = 0; //코멘트 리스트 초기화 | 195 | commentNum = 0; //코멘트 리스트 초기화 |
196 | + korNum = 0; | ||
182 | 197 | ||
183 | videoNum = queryData.videourl; | 198 | videoNum = queryData.videourl; |
184 | videoLang = queryData.languages; | 199 | videoLang = queryData.languages; |
... | @@ -190,7 +205,7 @@ var app = http.createServer(function(request,response){ // request는 브라우 | ... | @@ -190,7 +205,7 @@ var app = http.createServer(function(request,response){ // request는 브라우 |
190 | //유튜브 URL공유 기능을 사용하여 얻은 주소를 넣었을 때 videoNum 추출 | 205 | //유튜브 URL공유 기능을 사용하여 얻은 주소를 넣었을 때 videoNum 추출 |
191 | videoNum = videoNum.replace(URLreg1,""); | 206 | videoNum = videoNum.replace(URLreg1,""); |
192 | console.log(videoNum); | 207 | console.log(videoNum); |
193 | - let npt = "" | 208 | + let npt = ""; |
194 | if(queryData.nextpage != null) npt = queryData.nextpage | 209 | if(queryData.nextpage != null) npt = queryData.nextpage |
195 | loadcomment(apiKey,videoNum,npt,5, response); | 210 | loadcomment(apiKey,videoNum,npt,5, response); |
196 | } | 211 | } | ... | ... |
LICENSE.txt
0 → 100644
1 | +MIT License | ||
2 | + | ||
3 | +Copyright (c) 2022 Yuncheol Kwak | ||
4 | + | ||
5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
6 | +of this software and associated documentation files (the "Software"), to deal | ||
7 | +in the Software without restriction, including without limitation the rights | ||
8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
9 | +copies of the Software, and to permit persons to whom the Software is | ||
10 | +furnished to do so, subject to the following conditions: | ||
11 | + | ||
12 | +The above copyright notice and this permission notice shall be included in all | ||
13 | +copies or substantial portions of the Software. | ||
14 | + | ||
15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
21 | +SOFTWARE. | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | <div id="top"></div> | 1 | <div id="top"></div> |
2 | 2 | ||
3 | - | ||
4 | -<!-- PROJECT SHIELDS --> | ||
5 | -[![Contributors][contributors-shield]][contributors-url] | ||
6 | -[![Forks][forks-shield]][forks-url] | ||
7 | -[![Stargazers][stars-shield]][stars-url] | ||
8 | -[![Issues][issues-shield]][issues-url] | ||
9 | -[![MIT License][license-shield]][license-url] | ||
10 | -[![LinkedIn][linkedin-shield]][linkedin-url] | ||
11 | - | ||
12 | - | ||
13 | - | ||
14 | <!-- PROJECT LOGO --> | 3 | <!-- PROJECT LOGO --> |
15 | <br /> | 4 | <br /> |
16 | <div align="center"> | 5 | <div align="center"> |
17 | - <a href="https://github.com/github_username/repo_name"> | 6 | + <a href="http://khuhub.khu.ac.kr/2019102147/youtube-comment-seperator"> |
18 | <img src="images/logo.png" alt="Logo" width="80" height="80"> | 7 | <img src="images/logo.png" alt="Logo" width="80" height="80"> |
19 | </a> | 8 | </a> |
20 | 9 | ||
21 | <h3 align="center">Youtub-Comment-Seperator</h3> | 10 | <h3 align="center">Youtub-Comment-Seperator</h3> |
22 | 11 | ||
23 | <p align="center"> | 12 | <p align="center"> |
24 | - Find korean comments between english comments! | 13 | + Find someone from your country among foreigners! |
25 | <br /> | 14 | <br /> |
26 | <a href="http://khuhub.khu.ac.kr/2019102147/youtube-comment-seperator"><strong>Explore the docs »</strong></a> | 15 | <a href="http://khuhub.khu.ac.kr/2019102147/youtube-comment-seperator"><strong>Explore the docs »</strong></a> |
27 | <br /> | 16 | <br /> |
... | @@ -43,6 +32,7 @@ | ... | @@ -43,6 +32,7 @@ |
43 | <li> | 32 | <li> |
44 | <a href="#about-the-project">About The Project</a> | 33 | <a href="#about-the-project">About The Project</a> |
45 | <ul> | 34 | <ul> |
35 | + <li><a href="#project-architecture">Project Architecture</a></li> | ||
46 | <li><a href="#built-with">Built With</a></li> | 36 | <li><a href="#built-with">Built With</a></li> |
47 | </ul> | 37 | </ul> |
48 | </li> | 38 | </li> |
... | @@ -54,11 +44,9 @@ | ... | @@ -54,11 +44,9 @@ |
54 | </ul> | 44 | </ul> |
55 | </li> | 45 | </li> |
56 | <li><a href="#usage">Usage</a></li> | 46 | <li><a href="#usage">Usage</a></li> |
57 | - <li><a href="#roadmap">Roadmap</a></li> | ||
58 | <li><a href="#contributing">Contributing</a></li> | 47 | <li><a href="#contributing">Contributing</a></li> |
59 | <li><a href="#license">License</a></li> | 48 | <li><a href="#license">License</a></li> |
60 | <li><a href="#contact">Contact</a></li> | 49 | <li><a href="#contact">Contact</a></li> |
61 | - <li><a href="#acknowledgments">Acknowledgments</a></li> | ||
62 | </ol> | 50 | </ol> |
63 | </details> | 51 | </details> |
64 | 52 | ||
... | @@ -66,10 +54,19 @@ | ... | @@ -66,10 +54,19 @@ |
66 | 54 | ||
67 | <!-- ABOUT THE PROJECT --> | 55 | <!-- ABOUT THE PROJECT --> |
68 | ## About The Project | 56 | ## About The Project |
57 | +*** | ||
58 | +<div align="center"> | ||
59 | + <img src="images/screen.png" alt="screenshot"> | ||
60 | +</div> | ||
69 | 61 | ||
70 | -[![Product Name Screen Shot][product-screenshot]](https://example.com) | 62 | +* Select the language for comments you want to find |
63 | +* Show comments only the language you choosen | ||
64 | + | ||
65 | +### Project Architecture | ||
66 | +<div align="center"> | ||
67 | + <img src="images/project-architecture.png" alt="screenshot"> | ||
68 | +</div> | ||
71 | 69 | ||
72 | -Here's a blank template to get started: To avoid retyping too much info. Do a search and replace with your text editor for the following: `github_username`, `repo_name`, `twitter_handle`, `linkedin_username`, `email_client`, `email`, `project_title`, `project_description` | ||
73 | 70 | ||
74 | <p align="right">(<a href="#top">back to top</a>)</p> | 71 | <p align="right">(<a href="#top">back to top</a>)</p> |
75 | 72 | ||
... | @@ -80,6 +77,9 @@ Here's a blank template to get started: To avoid retyping too much info. Do a se | ... | @@ -80,6 +77,9 @@ Here's a blank template to get started: To avoid retyping too much info. Do a se |
80 | <img src="https://img.shields.io/badge/JavaScript-F7DF1E?style=flat-square&logo=javascript&logoColor=white"/> | 77 | <img src="https://img.shields.io/badge/JavaScript-F7DF1E?style=flat-square&logo=javascript&logoColor=white"/> |
81 | <img src="https://img.shields.io/badge/Node.js-339933?style=flat-square&logo=node.js&logoColor=white&"/> | 78 | <img src="https://img.shields.io/badge/Node.js-339933?style=flat-square&logo=node.js&logoColor=white&"/> |
82 | <img src="https://img.shields.io/badge/npm-CB3837?style=flat-square&logo=npm&logoColor=white&"/> | 79 | <img src="https://img.shields.io/badge/npm-CB3837?style=flat-square&logo=npm&logoColor=white&"/> |
80 | +<img src="https://img.shields.io/badge/Bootstrap-7952B3?style=flat-square&logo=bootstrap&logoColor=white&"/> | ||
81 | +<img src="https://img.shields.io/badge/Express-000000?style=flat-square&logo=express&logoColor=white&"/> | ||
82 | + | ||
83 | 83 | ||
84 | <p align="right">(<a href="#top">back to top</a>)</p> | 84 | <p align="right">(<a href="#top">back to top</a>)</p> |
85 | 85 | ||
... | @@ -87,32 +87,30 @@ Here's a blank template to get started: To avoid retyping too much info. Do a se | ... | @@ -87,32 +87,30 @@ Here's a blank template to get started: To avoid retyping too much info. Do a se |
87 | 87 | ||
88 | <!-- GETTING STARTED --> | 88 | <!-- GETTING STARTED --> |
89 | ## Getting Started | 89 | ## Getting Started |
90 | - | 90 | +*** |
91 | -This is an example of how you may give instructions on setting up your project locally. | ||
92 | -To get a local copy up and running follow these simple example steps. | ||
93 | 91 | ||
94 | ### Prerequisites | 92 | ### Prerequisites |
95 | 93 | ||
96 | -This is an example of how to list things you need to use the software and how to install them. | 94 | +Need to get free API Key |
97 | -* npm | 95 | +* [Google](https://console.cloud.google.com/apis/dashboard) - *Activate YouTube Data API v3* |
98 | - ```sh | 96 | +* [Naver](https://developers.naver.com/apps) |
99 | - npm install npm@latest -g | 97 | + |
100 | - ``` | ||
101 | 98 | ||
102 | ### Installation | 99 | ### Installation |
103 | 100 | ||
104 | -1. Get a free API Key at [https://console.cloud.google.com](https://console.cloud.google.com/marketplace/product/google/youtube.googleapis.com?q=search&referrer=search&project=eighth-keyword-349614&supportedpurview=project) | 101 | +1. Clone the repo |
105 | -2. Clone the repo | 102 | + ``` |
106 | - ```sh | ||
107 | git clone http://khuhub.khu.ac.kr/2019102147/youtube-comment-seperator.git | 103 | git clone http://khuhub.khu.ac.kr/2019102147/youtube-comment-seperator.git |
108 | ``` | 104 | ``` |
109 | -3. Install NPM packages | 105 | +2. Install NPM packages |
110 | - ```sh | 106 | + ``` |
111 | npm install | 107 | npm install |
112 | ``` | 108 | ``` |
113 | -4. Enter your API in `config.js` | 109 | +3. Need to Enter your API Keys in `APIs.json` |
114 | - ```js | 110 | + ``` |
115 | - const API_KEY = 'ENTER YOUR API'; | 111 | + "youtubeAPI" : "ENTER YOUR GOOGLE API", |
112 | + "papagoClientID" : "ENTER YOUR NAVER ClientID" | ||
113 | + "papagoClientSecret":"ENTER YOUR NAVER ClientSecret" | ||
116 | ``` | 114 | ``` |
117 | 115 | ||
118 | <p align="right">(<a href="#top">back to top</a>)</p> | 116 | <p align="right">(<a href="#top">back to top</a>)</p> |
... | @@ -121,41 +119,23 @@ This is an example of how to list things you need to use the software and how to | ... | @@ -121,41 +119,23 @@ This is an example of how to list things you need to use the software and how to |
121 | 119 | ||
122 | <!-- USAGE EXAMPLES --> | 120 | <!-- USAGE EXAMPLES --> |
123 | ## Usage | 121 | ## Usage |
124 | - | 122 | +*** |
125 | -Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources. | 123 | +* Get percentage of __Korean__ comments |
126 | - | 124 | +<div align="center"> |
127 | -_For more examples, please refer to the [Documentation](https://example.com)_ | 125 | + <img src="images/korpercent.png" alt="screenshot"> |
128 | - | 126 | +</div> |
129 | -<p align="right">(<a href="#top">back to top</a>)</p> | ||
130 | - | ||
131 | - | ||
132 | - | ||
133 | -<!-- ROADMAP --> | ||
134 | -## Roadmap | ||
135 | - | ||
136 | -- [ ] Feature 1 | ||
137 | -- [ ] Feature 2 | ||
138 | -- [ ] Feature 3 | ||
139 | - - [ ] Nested Feature | ||
140 | - | ||
141 | -See the [open issues](https://github.com/github_username/repo_name/issues) for a full list of proposed features (and known issues). | ||
142 | 127 | ||
143 | <p align="right">(<a href="#top">back to top</a>)</p> | 128 | <p align="right">(<a href="#top">back to top</a>)</p> |
144 | 129 | ||
145 | - | ||
146 | - | ||
147 | <!-- CONTRIBUTING --> | 130 | <!-- CONTRIBUTING --> |
148 | ## Contributing | 131 | ## Contributing |
149 | - | 132 | +*** |
150 | -Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. | 133 | +If you have a suggestion that would make this better, please fork the repo and create a pull request. |
151 | - | ||
152 | -If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". | ||
153 | -Don't forget to give the project a star! Thanks again! | ||
154 | 134 | ||
155 | 1. Fork the Project | 135 | 1. Fork the Project |
156 | -2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) | 136 | +2. Create your Feature Branch (`git checkout -b feature/feature_name`) |
157 | 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) | 137 | 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) |
158 | -4. Push to the Branch (`git push origin feature/AmazingFeature`) | 138 | +4. Push to the Branch (`git push origin feature/feature_name`) |
159 | 5. Open a Pull Request | 139 | 5. Open a Pull Request |
160 | 140 | ||
161 | <p align="right">(<a href="#top">back to top</a>)</p> | 141 | <p align="right">(<a href="#top">back to top</a>)</p> |
... | @@ -174,37 +154,9 @@ Distributed under the MIT License. See `LICENSE.txt` for more information. | ... | @@ -174,37 +154,9 @@ Distributed under the MIT License. See `LICENSE.txt` for more information. |
174 | <!-- CONTACT --> | 154 | <!-- CONTACT --> |
175 | ## Contact | 155 | ## Contact |
176 | 156 | ||
177 | -Your Name - [@twitter_handle](https://twitter.com/twitter_handle) - email@email_client.com | 157 | +Yuncheol Kwak - <lvbhkwak@khu.ac.kr> |
158 | +Kyoleen Kwak - <2007kkl@khu.ac.kr> | ||
178 | 159 | ||
179 | Project Link: [http://khuhub.khu.ac.kr/2019102147/youtube-comment-seperator](http://khuhub.khu.ac.kr/2019102147/youtube-comment-seperator) | 160 | Project Link: [http://khuhub.khu.ac.kr/2019102147/youtube-comment-seperator](http://khuhub.khu.ac.kr/2019102147/youtube-comment-seperator) |
180 | 161 | ||
181 | <p align="right">(<a href="#top">back to top</a>)</p> | 162 | <p align="right">(<a href="#top">back to top</a>)</p> |
182 | - | ||
183 | - | ||
184 | - | ||
185 | -<!-- ACKNOWLEDGMENTS --> | ||
186 | -## Acknowledgments | ||
187 | - | ||
188 | -* []() | ||
189 | -* []() | ||
190 | -* []() | ||
191 | - | ||
192 | -<p align="right">(<a href="#top">back to top</a>)</p> | ||
193 | - | ||
194 | - | ||
195 | - | ||
196 | -<!-- MARKDOWN LINKS & IMAGES --> | ||
197 | -<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links --> | ||
198 | -[contributors-shield]: https://img.shields.io/github/contributors/github_username/repo_name.svg?style=for-the-badge | ||
199 | -[contributors-url]: https://github.com/github_username/repo_name/graphs/contributors | ||
200 | -[forks-shield]: https://img.shields.io/github/forks/github_username/repo_name.svg?style=for-the-badge | ||
201 | -[forks-url]: https://github.com/github_username/repo_name/network/members | ||
202 | -[stars-shield]: https://img.shields.io/github/stars/github_username/repo_name.svg?style=for-the-badge | ||
203 | -[stars-url]: https://github.com/github_username/repo_name/stargazers | ||
204 | -[issues-shield]: https://img.shields.io/github/issues/github_username/repo_name.svg?style=for-the-badge | ||
205 | -[issues-url]: https://github.com/github_username/repo_name/issues | ||
206 | -[license-shield]: https://img.shields.io/github/license/github_username/repo_name.svg?style=for-the-badge | ||
207 | -[license-url]: https://github.com/github_username/repo_name/blob/master/LICENSE.txt | ||
208 | -[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555 | ||
209 | -[linkedin-url]: https://linkedin.com/in/linkedin_username | ||
210 | -[product-screenshot]: images/screenshot.png | ... | ... |
images/korpercent.png
0 → 100644
1.34 MB
images/logo.png
0 → 100644
119 KB
images/project-architecture.png
0 → 100644
166 KB
images/screen.png
0 → 100644
2.18 MB
-
Please register or login to post a comment