Skip to content

Instantly share code, notes, and snippets.

@khushalbokadey
Created January 30, 2017 12:41
Show Gist options
  • Save khushalbokadey/b4319c522d59584bd39eaf1103f9e024 to your computer and use it in GitHub Desktop.
Save khushalbokadey/b4319c522d59584bd39eaf1103f9e024 to your computer and use it in GitHub Desktop.
Get all answers of a user from Quora
var fs = require('fs');
var quora = require('quora-api');
var _ = require('lodash');
var json2csv = require('json2csv');
var questions = ['How-can-I-make-my-room-look-nicer-on-a-budget'];
module.exports = {
execute: function(callback) {
async.eachSeries(questions, function(question, cb) {
quora.answer.user(question + '/answer/Shriram-Kumar-14')
.then(answer => {
var csv = json2csv({
data: {
question: question,
answer: answer.answer
},
fields: ['question', 'answer']
});
console.log(question);
setTimeout(function() {
console.log("Waiting!!!");
}, 2000);
fs.appendFile('/home/khushal/Desktop/quora-1.csv', csv, function(err) {
if (err) {
return cb(err);
}
sails.log.verbose('file saved');
return cb(null);
});
});
}, callback)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment