곽교린

issue an apiKey and practice call comment in our program

1 +AIzaSyCjBrFKnBlGvxsfOD-qJP8nBkdEoqKRHu8
...\ No newline at end of file ...\ No newline at end of file
1 +{"web":{"client_id":"197854895056-dk8etrtt0otte8ebrra2c9lvt2k0mff4.apps.googleusercontent.com","project_id":"youtubecommentseperator","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"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","javascript_origins":["http://localhost:3031"]}}
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
1 +{
2 + "dependencies": {
3 + "googleapis": "^100.0.0",
4 + "youtube-v3-api": "^1.1.1"
5 + }
6 +}
1 +//https://www.npmjs.com/package/youtube-v3-api
2 +//http://khuhub.khu.ac.kr/2019102147/youtube-comment-seperator.git
3 +
4 +const apiKey = 'AIzaSyCjBrFKnBlGvxsfOD-qJP8nBkdEoqKRHu8';
5 +const {google} = require("googleapis");
6 +const service = google.youtube('v3');
7 +
8 +service.commentThreads.list({
9 + "key":apiKey,
10 + "part":[
11 + "snippet, replies"
12 + ],
13 + "videoId":"m1gHR4dJhKU"//비디오 주소
14 +}).then(function(response) {
15 + console.log("Response", response);
16 + console.log(response.data.items[0].snippet.topLevelComment.snippet.textDisplay)
17 + console.log(response.data.items[1].snippet.topLevelComment.snippet.textDisplay)
18 + },
19 + function(err) { console.error("Execute error", err); });
20 +
21 +
22 +/*
23 +service.comments.list({
24 + "key": apiKey,
25 + "part": [
26 + "snippet"
27 + ],
28 + "parentId": "UgzDE2tasfmrYLyNkGt4AaABAg"
29 +}).then(function(response) {
30 + // Handle the results here (response.result has the parsed body).
31 + console.log("Response", response);
32 + console.log(response.data.items)
33 + },
34 + function(err) { console.error("Execute error", err); });
35 +
36 +const {YoutubeDataAPI} = require("youtube-v3-api");
37 +const {google} = require("googleapis");
38 +
39 +const api = new YoutubeDataAPI(apiKey);
40 +
41 +api.searchComments("https://youtu.be/m1gHR4dJhKU").then((data)=>{
42 + console.log(data);
43 + console.log(data.pageInfo);
44 +},(err)=>{
45 + console.error(err);
46 +})
47 +*/
...\ No newline at end of file ...\ No newline at end of file