Created
August 18, 2015 16:24
-
-
Save kartben/d53fbf4ee9ddad20b636 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var YouTube = require('../lib/youtube'); | |
var config = require('./config'); | |
var fs = require('fs'); | |
var youTube = new YouTube(); | |
youTube.setKey(config.key); | |
youTube.getPlayListsItemsById('PLy7t4z5SYNaQS1XZ8uiqqn0nNLi4qU-VW', function(error, result) { | |
if (error) { | |
console.log(error); | |
} else { | |
console.log(result.items); | |
for (var i = 0; i < result.items.length; i++) { | |
var item = result.items[i]; | |
var contents = "+++\n"; | |
contents += 'date = "' + item.snippet.publishedAt + '"\n'; | |
contents += 'title = "' + item.snippet.title + '"\n'; | |
contents += 'link = "https://youtu.be/' + item.contentDetails.videoId + '"\n'; | |
contents += '+++\n'; | |
contents += 'Virtual IoT meetup recording:\n' + item.snippet.title; | |
fs.writeFile(item.snippet.publishedAt.substr(0, 10) + '-virtual-iot-recording', contents, function(err) { | |
if (err) { | |
return console.log(err); | |
} | |
console.log("The file was saved!"); | |
}); | |
}; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment