-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_csv_data.js
More file actions
33 lines (28 loc) · 882 Bytes
/
generate_csv_data.js
File metadata and controls
33 lines (28 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var fs = require('fs');
var underscore = require('underscore');
var youtube = require("youtube-api")
var youtubedl = require('youtube-dl');
var apiconfig = JSON.parse(fs.readFileSync(__dirname + '/config/apiconfig.json', 'utf8'));
var youtube_config = {type: "key"};
youtube_config = underscore.extend(youtube_config, apiconfig.google_api)
youtube.authenticate(youtube_config);
youtube.search.list({
part: 'id,snippet',
type: 'video',
relatedToVideoId: "0E00Zuayv9Q",
maxResults: 50
}, function(err, data){
console.log(data);
data.items.forEach(function(item){
console.log(item);
})
});
/*
var video = youtubedl('http://www.youtube.com/watch?v=0E00Zuayv9Q');
// Will be called when the download starts.
video.on('info', function(info) {
console.log('Download started');
console.log(info);
});
video.pipe(fs.createWriteStream('myvideo.mp4'));
*/