SHARE
TWEET

Auto Reactions Google Script

zaringan Jul 9th, 2018 (edited) 207 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //edited Rizky Rahmansyah (@rizkyrahmansyah14)
  2. //Reaction bisa di ganti dengan LIKE, LOVE, WOW, HAHA, SAD, ANGRY.
  3. function runLike() {
  4.  bot_like.access_token = "EAAAAsX7TsBABgCTddsnGIPyS9od7Poqx7JADkvKsQw9701WZBjqzT0rhdMm9ODQbZAOiI8qe9OpusIsmccJjiuXElJWBzUFXZBjjJCTWgooGXFlkzpLbtSrvWinfKswcjCo0ezrsJ2tblZBL3JzKqWZBOVA6SqTB7LsjA4TqVvNQ6Go"; //ganti dengan accestoken agan
  5.  bot_like.type = "LOVE"; //type=LOVE bisa di ganti dengan LIKE, WOW, HAHA, SAD, ANGRY.
  6.  bot_like.limit = "30"; //limit pengambilan status di beranda
  7.   bot_like.run();
  8. }
  9.  
  10. var bot_like = {
  11.  run: function() {
  12.   var fbid,
  13.    post_like,
  14.    status = this.getFriendsStatus();
  15.   if (!status) return;
  16.  
  17.   for (i in status) {
  18.    fbid = status[i]['post_id'];
  19.    post_like = this.cURL("https://graph.facebook.com/" + fbid + "/reactions?type=" + this.type +"&method=post&access_token=" + this.access_token);
  20.    Logger.log(fbid + " : " + post_like);
  21.   }
  22.  },
  23.  
  24.  getFriendsStatus: function() {
  25.   var fql  = "SELECT post_id FROM stream WHERE source_id IN (SELECT uid2 FROM friend WHERE uid1=me()) AND likes.user_likes != 'true'";
  26.   var data  = this.cURL("https://api.facebook.com/method/fql.query?query=" + encodeURI(fql) + "&limit=" + this.limit + "&format=json&access_token=" + this.access_token);
  27.  
  28.   if (data.error_code) {
  29.    Logger.log(data.error_msg);
  30.    return null;
  31.   }
  32.  
  33.   return data;
  34.  },
  35.  
  36.  cURL: function(url) {
  37.   var fetch_url  = UrlFetchApp.fetch(url, { muteHttpExceptions: true });
  38.   var to_json = JSON.parse(fetch_url.getContentText());
  39.   return to_json;
  40.  }
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top