Example #1
0
 getEvent: function (cb, id) {
   var url = id + '?fields=name,description,is_date_only,start_time,end_time,updated_time,owner,timezone,venue';
   //console.log(url);
   graph.setOptions(options).get(url, function (err, res) {
     Conf.debug && console.log("\r\n App.getEvent Data:\r\n", res);
     cb && cb(res);
     Data.setEvents(console.log, [res]);
   });
 }
Example #2
0
			getSNProfile: function(callback){
				 fbgraph.setAccessToken(req.body.token);
			      fbgraph.setOptions(fboptions).get("me", function(err, fbres) {
			    	  if (fbres.error) {
				          callback(ERROR.token_unauth);
				      }
				      else {
				    	req.body.email = fbres.email;
				        callback(null,fbres);
				      }
			      });
			 },
Example #3
0
  getSearchList: function (cb, terms) {
    graph.setOptions(options).get("search?type=event&q=" + terms, function (err, res) {
      Conf.debug && console.log("\r\n App.getSearchList Data:\r\n", res);

      Data.setSearchList(console.log, res.data);

      // Obtenha ainda mais informações sobre esses eventos
      if (res.data && res.data.length) {
        res.data.forEach(function (item, idx) {
          module.exports.next(function () {
            module.exports.getEvent(null, res.data[idx].id);
          }, idx);
        });
      }

      cb && cb(res.data);
    });
  },
app.get('/facebookaccount', ensureAuthenticated, function(req, res){
  var options = {
    timeout:  3000,
    pool: { maxSockets:  Infinity },
    headers: { connection: "keep-alive" }
  }
  var params = { fields: "message,from,full_picture", limit: 30 };
  graph.setOptions(options).get("me/feed", params, function(err, resp) {
    var ret = {posts:[]};
    var data = [];
    var d = resp['data'];
    var emotions = drake.getEmotions();
    for(var i in d){
      if(d[i].message && d[i].full_picture){
        ret.posts.push({
          'picture': d[i].full_picture,
          'message': d[i].message,
          'author': d[i].from.name,
          'emotion': emotions[i],
          'id': i
        });
      }else if(d[i].message){
        data.push(d[i].message);
        ret.posts.push({
          'message': d[i].message,
          'emotion': emotions[i],
          'author': d[i].from.name,
          'id': i
        });
      }
    }
    var song = drake.findSong(data);
    song['song'] = song['song'].toLowerCase();
    res.render('facebookaccount', {song: song, user:req.user, data:ret});
  });
});
Example #5
0
const graph = require('fbgraph');

const FACEBOOK_REQUEST_TIMEOUT = 1000 * 30; // value in milliseconds

graph.setVersion('2.5');
graph.setOptions({
  timeout: FACEBOOK_REQUEST_TIMEOUT,
});

module.exports = graph;