Created
June 4, 2014 01:29
-
-
Save drewblaisdell/5213ebb284a3bf251669 to your computer and use it in GitHub Desktop.
Downloading the newest snap from Snapchat
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 snapchat = require('node-snapchat'), | |
fs = require('fs'), | |
username = "username", | |
password = "password"; | |
var client = new snapchat.Client({ username: username, password: password }); | |
client.on('loggedin', function(){ | |
var timestamp = String(Math.round(new Date().getTime() / 1000)); | |
client.getSnaps(timestamp, function(result){ | |
var snap = result[0]; | |
var stream = fs.createWriteStream('./' + snap.id + '.jpg', { flags: 'w', encoding: null, mode: 0666 }); | |
client.getBlob(snap.id, stream, function() { } ); | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment