Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. var aing={
  2. getApi:function(huh){var a=UrlFetchApp.fetch(huh,{muteHttpExceptions:true,method:"get",validateHttpsCertificates:false}),b=JSON.parse(a.getContentText());return b},
  3. setApi:function(huh,pl){var a=UrlFetchApp.fetch(huh,{muteHttpExceptions:true,method:"post",payload:pl,validateHttpsCertificates:false}),b=JSON.parse(a.getContentText());return b}
  4. };
  5.  
  6. function reaction(){
  7. var token="TOKEN";
  8. var tipe="LOVE"; //LIKE, LOVE, WOW, HAHA, SAD, ANGRY, THANKFUL
  9. var limit="5";
  10. var ambil=aing.getApi("https://graph.beta.beta.beta.facebook.com/me/home?access_token="+token+"&fields=id&limit="+limit);
  11. for(var i in ambil.data){
  12. var react=aing.setApi("https://graph.beta.beta.facebook.co.id/"+ambil.data[i].id+"/reactions",{access_token:token,method:"post",type:tipe});
  13. if(react.success){ // CTRL + ENTER untuk melihat Log
  14. Logger.log(ambil.data[i].id+":success");
  15. }else{
  16. Logger.log(ambil.data[i].id+":error");
  17. }
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement