곽교린

Merge branch 'master' of http://khuhub.khu.ac.kr/2019102147/youtube-comment-seperator into develop

1 -import {franc} from 'franc';
2 -import langs from 'langs';
3 -
4 -function getLang(se) {
5 - let langCode = "";
6 - if(se.length < 10) {
7 - langCode = franc(se, {minLength:`${se.length}`});
8 - } else {
9 - langCode = franc(se);
10 - }
11 - return langs.where('3', langCode).local;
12 -}
13 -
14 -export {getLang};
...\ No newline at end of file ...\ No newline at end of file
1 -//https://developers.google.com/youtube/v3/docs/commentThreads/list
2 -//http://khuhub.khu.ac.kr/2019102147/youtube-comment-seperator.git
3 -
4 -const apiKey = 'AIzaSyCjBrFKnBlGvxsfOD-qJP8nBkdEoqKRHu8';
5 -let videoNum = "m1gHR4dJhKU";
6 -const {google} = require("googleapis");
7 -const service = google.youtube('v3');
8 -var npt = ""
9 -
10 -for(let i = 0; i < 3; i++){
11 - console.log(npt);
12 - service.commentThreads.list({
13 - "key":apiKey,
14 - "part":[
15 - "snippet, replies"
16 - ],
17 - "videoId":videoNum,//비디오 주소
18 - "maxResults" : 10,
19 - "pageToken" : npt
20 - }).then(function(response) {
21 - console.log("Response", response);
22 - console.log(response.data.items[0].snippet.topLevelComment.snippet.textDisplay);
23 - console.log(response.data.items[1].snippet.topLevelComment.snippet.textDisplay);
24 - npt = JSON.parse(response.data.nextPageToken);
25 - },
26 - function(err) { console.error("Execute error", err); });
27 -}
28 -
29 -
30 -/*
31 -service.comments.list({
32 - "key": apiKey,
33 - "part": [
34 - "snippet"
35 - ],
36 - "parentId": "UgzDE2tasfmrYLyNkGt4AaABAg"
37 -}).then(function(response) {
38 - // Handle the results here (response.result has the parsed body).
39 - console.log("Response", response);
40 - console.log(response.data.items)
41 - },
42 - function(err) { console.error("Execute error", err); });
43 -
44 -const {YoutubeDataAPI} = require("youtube-v3-api");
45 -const {google} = require("googleapis");
46 -
47 -const api = new YoutubeDataAPI(apiKey);
48 -
49 -api.searchComments("https://youtu.be/m1gHR4dJhKU").then((data)=>{
50 - console.log(data);
51 - console.log(data.pageInfo);
52 -},(err)=>{
53 - console.error(err);
54 -})
55 -*/
...\ No newline at end of file ...\ No newline at end of file