Ubuntu

Trying to connect Linebot with youtube

1 +var {google} =require('googleapis');
2 +
3 +//1
4 +var service = google.youtube('v3');
5 +service.videos.list({
6 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
7 + part: 'snippet',
8 + id: '8ykMyNHAdKk', // 동영상 Id 팔레트
9 + fields: 'items(snippet(title))'
10 +}, function(err, response) {
11 + if (err) {
12 + console.log('The API returned an error: ',err);
13 + return;
14 + }
15 +
16 + var video =response.data.items;
17 + if(video.length ==0){
18 + console.log('검색된 동영상이 없습니다.');
19 + } else {
20 + console.log(JSON.stringify(response.data.items[0],null,4));
21 + }
22 +})
23 +//2
24 +service.videos.list({
25 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
26 + part: 'snippet',
27 + id: '6744glqD6lk', // 동영상 Id 밤편지
28 + fields: 'items(snippet(title))'
29 +}, function(err, response) {
30 + if (err) {
31 + console.log('The API returned an error: ',err);
32 + return;
33 + }
34 +
35 + var video =response.data.items;
36 + if(video.length ==0){
37 + console.log('검색된 동영상이 없습니다.');
38 + } else {
39 + console.log(JSON.stringify(response.data.items[0],null,4));
40 + }
41 +})
42 +//3
43 +service.videos.list({
44 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
45 + part: 'snippet',
46 + id: 'he2C4lx63M0', // 동영상 Id 마음
47 + fields: 'items(snippet(title))'
48 +}, function(err, response) {
49 + if (err) {
50 + console.log('The API returned an error: ',err);
51 + return;
52 + }
53 +
54 + var video =response.data.items;
55 + if(video.length ==0){
56 + console.log('검색된 동영상이 없습니다.');
57 + } else {
58 + console.log(JSON.stringify(response.data.items[0],null,4));
59 + }
60 +})
61 +//4
62 +service.videos.list({
63 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
64 + part: 'snippet',
65 + id: 'xKZ3U8viuIU', // 동영상 Id 금요일에 만나요
66 + fields: 'items(snippet(title))'
67 +}, function(err, response) {
68 + if (err) {
69 + console.log('The API returned an error: ',err);
70 + return;
71 + }
72 +
73 + var video =response.data.items;
74 + if(video.length ==0){
75 + console.log('검색된 동영상이 없습니다.');
76 + } else {
77 + console.log(JSON.stringify(response.data.items[0],null,4));
78 + }
79 +})
80 +//5
81 +service.videos.list({
82 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
83 + part: 'snippet',
84 + id: 'seFr4qWykgY', // 동영상 Id 너랑나
85 + fields: 'items(snippet(title))'
86 +}, function(err, response) {
87 + if (err) {
88 + console.log('The API returned an error: ',err);
89 + return;
90 + }
91 +
92 + var video =response.data.items;
93 + if(video.length ==0){
94 + console.log('검색된 동영상이 없습니다.');
95 + } else {
96 + console.log(JSON.stringify(response.data.items[0],null,4));
97 + }
98 +})
99 +//6
100 +service.videos.list({
101 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
102 + part: 'snippet',
103 + id: 'r_-GQjN9Tpc', // 동영상 Id 내 손을 잡아
104 + fields: 'items(snippet(title))'
105 +}, function(err, response) {
106 + if (err) {
107 + console.log('The API returned an error: ',err);
108 + return;
109 + }
110 +
111 + var video =response.data.items;
112 + if(video.length ==0){
113 + console.log('검색된 동영상이 없습니다.');
114 + } else {
115 + console.log(JSON.stringify(response.data.items[0],null,4));
116 + }
117 +})
118 +//7
119 +service.videos.list({
120 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
121 + part: 'snippet',
122 + id: 'OIHlzvEKncQ', // 동영상 Id 좋은날
123 + fields: 'items(snippet(title))'
124 +}, function(err, response) {
125 + if (err) {
126 + console.log('The API returned an error: ',err);
127 + return;
128 + }
129 +
130 + var video =response.data.items;
131 + if(video.length ==0){
132 + console.log('검색된 동영상이 없습니다.');
133 + } else {
134 + console.log(JSON.stringify(response.data.items[0],null,4));
135 + }
136 +})
137 +//8
138 +service.videos.list({
139 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
140 + part: 'snippet',
141 + id: '04tYkKUPPv4', // 동영상 Id 라일락
142 + fields: 'items(snippet(title))'
143 +}, function(err, response) {
144 + if (err) {
145 + console.log('The API returned an error: ',err);
146 + return;
147 + }
148 +
149 + var video =response.data.items;
150 + if(video.length ==0){
151 + console.log('검색된 동영상이 없습니다.');
152 + } else {
153 + console.log(JSON.stringify(response.data.items[0],null,4));
154 + }
155 +})
156 +//9
157 +service.videos.list({
158 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
159 + part: 'snippet',
160 + id: '0ldJaGupC1o', // 동영상 Id 사랑이 잘
161 + fields: 'items(snippet(title))'
162 +}, function(err, response) {
163 + if (err) {
164 + console.log('The API returned an error: ',err);
165 + return;
166 + }
167 +
168 + var video =response.data.items;
169 + if(video.length ==0){
170 + console.log('검색된 동영상이 없습니다.');
171 + } else {
172 + console.log(JSON.stringify(response.data.items[0],null,4));
173 + }
174 +})
175 +//10
176 +service.videos.list({
177 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
178 + part: 'snippet',
179 + id: 'l0rcWimJmQ8', // 동영상 Id 봄 사랑, 벛꽃 말고
180 + fields: 'items(snippet(title))'
181 +}, function(err, response) {
182 + if (err) {
183 + console.log('The API returned an error: ',err);
184 + return;
185 + }
186 +
187 + var video =response.data.items;
188 + if(video.length ==0){
189 + console.log('검색된 동영상이 없습니다.');
190 + } else {
191 + console.log(JSON.stringify(response.data.items[0],null,4));
192 + }
193 +})
1 +var {google} =require('googleapis');
2 +
3 +//1
4 +var service = google.youtube('v3');
5 +service.videos.list({
6 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
7 + part: 'snippet',
8 + id: 'j-seAiANLG8', // 동영상 Id
9 + fields: 'items(snippet(title))'
10 +}, function(err, response) {
11 + if (err) {
12 + console.log('The API returned an error: ',err);
13 + return;
14 + }
15 +
16 + var video =response.data.items;
17 + if(video.length ==0){
18 + console.log('검색된 동영상이 없습니다.');
19 + } else {
20 + console.log(JSON.stringify(response.data.items[0],null,4));
21 + }
22 +})
23 +//2
24 +service.videos.list({
25 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
26 + part: 'snippet',
27 + id: 'F8c8f2nK82w', // 동영상 Id
28 + fields: 'items(snippet(title))'
29 +}, function(err, response) {
30 + if (err) {
31 + console.log('The API returned an error: ',err);
32 + return;
33 + }
34 +
35 + var video =response.data.items;
36 + if(video.length ==0){
37 + console.log('검색된 동영상이 없습니다.');
38 + } else {
39 + console.log(JSON.stringify(response.data.items[0],null,4));
40 + }
41 +})
42 +//3
43 +service.videos.list({
44 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
45 + part: 'snippet',
46 + id: 'IfemyZEhfpY', // 동영상 Id
47 + fields: 'items(snippet(title))'
48 +}, function(err, response) {
49 + if (err) {
50 + console.log('The API returned an error: ',err);
51 + return;
52 + }
53 +
54 + var video =response.data.items;
55 + if(video.length ==0){
56 + console.log('검색된 동영상이 없습니다.');
57 + } else {
58 + console.log(JSON.stringify(response.data.items[0],null,4));
59 + }
60 +})
61 +//4
62 +service.videos.list({
63 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
64 + part: 'snippet',
65 + id: '86suvlS1pGM', // 동영상 Id
66 + fields: 'items(snippet(title))'
67 +}, function(err, response) {
68 + if (err) {
69 + console.log('The API returned an error: ',err);
70 + return;
71 + }
72 +
73 + var video =response.data.items;
74 + if(video.length ==0){
75 + console.log('검색된 동영상이 없습니다.');
76 + } else {
77 + console.log(JSON.stringify(response.data.items[0],null,4));
78 + }
79 +})
80 +//5
81 +service.videos.list({
82 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
83 + part: 'snippet',
84 + id: 'ztmOmJrTF5c', // 동영상 Id
85 + fields: 'items(snippet(title))'
86 +}, function(err, response) {
87 + if (err) {
88 + console.log('The API returned an error: ',err);
89 + return;
90 + }
91 +
92 + var video =response.data.items;
93 + if(video.length ==0){
94 + console.log('검색된 동영상이 없습니다.');
95 + } else {
96 + console.log(JSON.stringify(response.data.items[0],null,4));
97 + }
98 +})
99 +//6
100 +service.videos.list({
101 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
102 + part: 'snippet',
103 + id: '6jAHysZVtwI', // 동영상 Id
104 + fields: 'items(snippet(title))'
105 +}, function(err, response) {
106 + if (err) {
107 + console.log('The API returned an error: ',err);
108 + return;
109 + }
110 +
111 + var video =response.data.items;
112 + if(video.length ==0){
113 + console.log('검색된 동영상이 없습니다.');
114 + } else {
115 + console.log(JSON.stringify(response.data.items[0],null,4));
116 + }
117 +})
118 +//7
119 +service.videos.list({
120 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
121 + part: 'snippet',
122 + id: 'fFZ1__X-kKs', // 동영상 Id
123 + fields: 'items(snippet(title))'
124 +}, function(err, response) {
125 + if (err) {
126 + console.log('The API returned an error: ',err);
127 + return;
128 + }
129 +
130 + var video =response.data.items;
131 + if(video.length ==0){
132 + console.log('검색된 동영상이 없습니다.');
133 + } else {
134 + console.log(JSON.stringify(response.data.items[0],null,4));
135 + }
136 +})
137 +//8
138 +service.videos.list({
139 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
140 + part: 'snippet',
141 + id: 'ei0k_1Uro-U', // 동영상 Id
142 + fields: 'items(snippet(title))'
143 +}, function(err, response) {
144 + if (err) {
145 + console.log('The API returned an error: ',err);
146 + return;
147 + }
148 +
149 + var video =response.data.items;
150 + if(video.length ==0){
151 + console.log('검색된 동영상이 없습니다.');
152 + } else {
153 + console.log(JSON.stringify(response.data.items[0],null,4));
154 + }
155 +})
156 +//9
157 +service.videos.list({
158 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
159 + part: 'snippet',
160 + id: 'mCtVrf2x5BQ', // 동영상 Id
161 + fields: 'items(snippet(title))'
162 +}, function(err, response) {
163 + if (err) {
164 + console.log('The API returned an error: ',err);
165 + return;
166 + }
167 +
168 + var video =response.data.items;
169 + if(video.length ==0){
170 + console.log('검색된 동영상이 없습니다.');
171 + } else {
172 + console.log(JSON.stringify(response.data.items[0],null,4));
173 + }
174 +})
175 +//10
176 +service.videos.list({
177 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
178 + part: 'snippet',
179 + id: 'FV003QMWhNM', // 동영상 Id
180 + fields: 'items(snippet(title))'
181 +}, function(err, response) {
182 + if (err) {
183 + console.log('The API returned an error: ',err);
184 + return;
185 + }
186 +
187 + var video =response.data.items;
188 + if(video.length ==0){
189 + console.log('검색된 동영상이 없습니다.');
190 + } else {
191 + console.log(JSON.stringify(response.data.items[0],null,4));
192 + }
193 +})
1 +var {google} =require('googleapis');
2 +
3 +//1
4 +var service = google.youtube('v3');
5 +service.videos.list({
6 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
7 + part: 'snippet',
8 + id: 'p5iu1V30myk', // 동영상 Id
9 + fields: 'items(snippet(title))'
10 +}, function(err, response) {
11 + if (err) {
12 + console.log('The API returned an error: ',err);
13 + return;
14 + }
15 +
16 + var video =response.data.items;
17 + if(video.length ==0){
18 + console.log('검색된 동영상이 없습니다.');
19 + } else {
20 + console.log(JSON.stringify(response.data.items[0],null,4));
21 + }
22 +})
23 +//2
24 +service.videos.list({
25 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
26 + part: 'snippet',
27 + id: 'i-SBnhaZSSU', // 동영상 Id
28 + fields: 'items(snippet(title))'
29 +}, function(err, response) {
30 + if (err) {
31 + console.log('The API returned an error: ',err);
32 + return;
33 + }
34 +
35 + var video =response.data.items;
36 + if(video.length ==0){
37 + console.log('검색된 동영상이 없습니다.');
38 + } else {
39 + console.log(JSON.stringify(response.data.items[0],null,4));
40 + }
41 +})
42 +//3
43 +service.videos.list({
44 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
45 + part: 'snippet',
46 + id: 'Etfgb6A7hSI', // 동영상 Id
47 + fields: 'items(snippet(title))'
48 +}, function(err, response) {
49 + if (err) {
50 + console.log('The API returned an error: ',err);
51 + return;
52 + }
53 +
54 + var video =response.data.items;
55 + if(video.length ==0){
56 + console.log('검색된 동영상이 없습니다.');
57 + } else {
58 + console.log(JSON.stringify(response.data.items[0],null,4));
59 + }
60 +})
61 +//4
62 +service.videos.list({
63 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
64 + part: 'snippet',
65 + id: 'IN2mml9xs_s', // 동영상 Id
66 + fields: 'items(snippet(title))'
67 +}, function(err, response) {
68 + if (err) {
69 + console.log('The API returned an error: ',err);
70 + return;
71 + }
72 +
73 + var video =response.data.items;
74 + if(video.length ==0){
75 + console.log('검색된 동영상이 없습니다.');
76 + } else {
77 + console.log(JSON.stringify(response.data.items[0],null,4));
78 + }
79 +})
80 +//5
81 +service.videos.list({
82 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
83 + part: 'snippet',
84 + id: 'tp1uoFAfgHE', // 동영상 Id
85 + fields: 'items(snippet(title))'
86 +}, function(err, response) {
87 + if (err) {
88 + console.log('The API returned an error: ',err);
89 + return;
90 + }
91 +
92 + var video =response.data.items;
93 + if(video.length ==0){
94 + console.log('검색된 동영상이 없습니다.');
95 + } else {
96 + console.log(JSON.stringify(response.data.items[0],null,4));
97 + }
98 +})
99 +//6
100 +service.videos.list({
101 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
102 + part: 'snippet',
103 + id: 'Qx22TnVVIfU', // 동영상 Id
104 + fields: 'items(snippet(title))'
105 +}, function(err, response) {
106 + if (err) {
107 + console.log('The API returned an error: ',err);
108 + return;
109 + }
110 +
111 + var video =response.data.items;
112 + if(video.length ==0){
113 + console.log('검색된 동영상이 없습니다.');
114 + } else {
115 + console.log(JSON.stringify(response.data.items[0],null,4));
116 + }
117 +})
118 +//7
119 +service.videos.list({
120 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
121 + part: 'snippet',
122 + id: '3y1QIqR115A', // 동영상 Id
123 + fields: 'items(snippet(title))'
124 +}, function(err, response) {
125 + if (err) {
126 + console.log('The API returned an error: ',err);
127 + return;
128 + }
129 +
130 + var video =response.data.items;
131 + if(video.length ==0){
132 + console.log('검색된 동영상이 없습니다.');
133 + } else {
134 + console.log(JSON.stringify(response.data.items[0],null,4));
135 + }
136 +})
137 +//8
138 +service.videos.list({
139 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
140 + part: 'snippet',
141 + id: 'VXBI1wt8XII', // 동영상 Id
142 + fields: 'items(snippet(title))'
143 +}, function(err, response) {
144 + if (err) {
145 + console.log('The API returned an error: ',err);
146 + return;
147 + }
148 +
149 + var video =response.data.items;
150 + if(video.length ==0){
151 + console.log('검색된 동영상이 없습니다.');
152 + } else {
153 + console.log(JSON.stringify(response.data.items[0],null,4));
154 + }
155 +})
156 +//9
157 +service.videos.list({
158 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
159 + part: 'snippet',
160 + id: 'aWMBn2--E0Q', // 동영상 Id
161 + fields: 'items(snippet(title))'
162 +}, function(err, response) {
163 + if (err) {
164 + console.log('The API returned an error: ',err);
165 + return;
166 + }
167 +
168 + var video =response.data.items;
169 + if(video.length ==0){
170 + console.log('검색된 동영상이 없습니다.');
171 + } else {
172 + console.log(JSON.stringify(response.data.items[0],null,4));
173 + }
174 +})
175 +//10
176 +service.videos.list({
177 + key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
178 + part: 'snippet',
179 + id: 'HyTbgBlnLCo', // 동영상 Id
180 + fields: 'items(snippet(title))'
181 +}, function(err, response) {
182 + if (err) {
183 + console.log('The API returned an error: ',err);
184 + return;
185 + }
186 +
187 + var video =response.data.items;
188 + if(video.length ==0){
189 + console.log('검색된 동영상이 없습니다.');
190 + } else {
191 + console.log(JSON.stringify(response.data.items[0],null,4));
192 + }
193 +})
...@@ -3,7 +3,7 @@ var {google} =require('googleapis'); ...@@ -3,7 +3,7 @@ var {google} =require('googleapis');
3 var service = google.youtube('v3'); 3 var service = google.youtube('v3');
4 service.videos.list({ 4 service.videos.list({
5 key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518', 5 key: 'AIzaSyBInggOtXxPFYIRee0Xs3vb5iZ9YE9_518',
6 - part: 'snippet,statistics', 6 + part: 'snippet',
7 id: 'p5iu1V30myk', // 동영상 Id 7 id: 'p5iu1V30myk', // 동영상 Id
8 fields: 'items(snippet(title))' 8 fields: 'items(snippet(title))'
9 }, function(err, response) { 9 }, function(err, response) {
......