diff --git a/README.md b/README.md index 49e1ac9..66970a0 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,12 @@ Basically, it will log into your Facebook account and click on "every" possible Since most of my fb_friends feel flattered, empowered, loved,... when they receive a 'like' for their actions on facebook, I thought I might automate some love giving and distribute 'likes' to my friends in a more efficient way. Or have I just created the first like-spamming application? ## Usage -`casperjs lovemachine.js --email= --password=` +`casperjs lovemachine.js --email= --password= --strictmode=` (On Windows, if that doesn't work, you may want to change 'casperjs' to casperjs_directory\casperjs.) +strictmode: if strictmode is set to true, the machine will not like game posts. + ## History This project has started a couple years ago and was first done in Python using Selenium Webdriver with the intention of working as a standalone server application. But for some reason, it never reached that stage because having a chromeless firefox behaving like a desktop one with selenium on top of it, was something I could not achieve. @@ -20,7 +22,7 @@ So earlier 2013, the project was rewritten in javascript using phantomjs and cas ### July 2014 - * A first [pull request](https://github.com/xuv/loveMachine/pull/2) by [Anne Li](https://github.com/lianna5), provides a .bat script for easier installation on Windows. + * A first [pull request](https://github.com/xuv/loveMachine/pull/2) by [Anna Li](https://github.com/lianna5), provides a .bat script for easier installation on Windows. * [Andrew Nakas](https://github.com/andrewnakas) came with the idea to use the mobile verison of Facebook as a fix for the problem of the "regular" Facebook removing "likes" on posts a minute after they been clicked by the \[loveMachine\]. ## Requirements diff --git a/casperjs/love-2014.txt b/casperjs/love-2014.txt new file mode 100644 index 0000000..50a012f --- /dev/null +++ b/casperjs/love-2014.txt @@ -0,0 +1,28 @@ +{"start":"2014-07-21T15:45:05.825Z","end":"2014-07-21T15:45:18.958Z","likes":0,"posts":0,"comments":0} +{"start":"2014-07-21T23:47:29.633Z","end":"2014-07-21T23:59:36.280Z","likes":78,"posts":79,"comments":-1} +{"start":"2014-07-22T00:31:58.930Z","end":"2014-07-22T00:44:09.302Z","likes":74,"posts":75,"comments":-1} +{"start":"2014-07-22T00:48:57.077Z","end":"2014-07-22T00:51:18.789Z","likes":12,"posts":13,"comments":-1} +{"start":"2014-07-22T01:06:19.831Z","end":"2014-07-22T01:08:49.464Z","likes":16,"posts":17,"comments":-1} +{"start":"2014-07-22T02:12:40.876Z","end":"2014-07-22T02:17:12.213Z","likes":25,"posts":26,"comments":-1} +{"start":"2014-07-22T13:40:44.258Z","end":"2014-07-22T13:56:31.976Z","likes":102,"posts":103,"comments":-1} +{"start":"2014-07-22T14:57:11.792Z","end":"2014-07-22T15:11:25.421Z","likes":70,"posts":71,"comments":-1} +{"start":"2014-07-22T20:47:41.205Z","end":"2014-07-22T20:58:26.941Z","likes":62,"posts":63,"comments":-1} +{"start":"2014-07-22T22:29:53.356Z","end":"2014-07-22T22:39:41.724Z","likes":57,"posts":58,"comments":-1} +{"start":"2014-07-27T21:14:20.316Z","end":"2014-07-27T21:16:43.364Z","likes":13,"posts":14,"comments":-1} +{"start":"2014-07-27T21:32:27.164Z","end":"2014-07-27T21:35:31.767Z","likes":15,"posts":16,"comments":-1} +{"start":"2014-07-28T00:25:15.387Z","end":"2014-07-28T00:34:10.321Z","likes":52,"posts":53,"comments":-1} +{"start":"2014-07-28T02:16:20.617Z","end":"2014-07-28T02:28:12.002Z","likes":72,"posts":73,"comments":-1} +{"start":"2014-07-28T02:35:55.263Z","end":"2014-07-28T02:49:00.374Z","likes":82,"posts":83,"comments":-1} +{"start":"2014-07-28T19:32:37.962Z","end":"2014-07-28T19:43:19.079Z","likes":62,"posts":63,"comments":-1} +{"start":"2014-07-30T02:39:04.230Z","end":"2014-07-30T02:50:16.910Z","likes":66,"posts":67,"comments":-1} +{"start":"2014-08-12T00:40:53.774Z","end":"2014-08-12T00:53:11.103Z","likes":76,"posts":77,"comments":-1} +{"start":"2014-08-12T01:21:14.333Z","end":"2014-08-12T01:31:58.639Z","likes":66,"posts":67,"comments":-1} +{"start":"2014-08-12T01:41:51.163Z","end":"2014-08-12T01:50:08.187Z","likes":49,"posts":50,"comments":-1} +{"start":"2014-08-12T02:49:58.486Z","end":"2014-08-12T03:01:20.689Z","likes":66,"posts":67,"comments":-1} +{"start":"2014-08-12T12:39:50.071Z","end":"2014-08-12T12:50:25.991Z","likes":61,"posts":62,"comments":-1} +{"start":"2014-08-15T22:18:08.265Z","end":"2014-08-15T22:29:44.519Z","likes":67,"posts":68,"comments":-1} +{"start":"2014-08-19T16:59:58.881Z","end":"2014-08-19T17:01:25.298Z","likes":3,"posts":4,"comments":-1} +{"start":"2014-08-19T18:13:10.394Z","end":"2014-08-19T18:13:24.647Z","likes":-1,"posts":0,"comments":-1} +{"start":"2014-08-19T18:44:18.980Z","end":"2014-08-19T18:44:32.190Z","likes":-1,"posts":0,"comments":-1} +{"start":"2014-08-19T18:44:44.879Z","end":"2014-08-19T18:44:57.958Z","likes":-1,"posts":0,"comments":-1} +{"start":"2014-08-19T18:46:46.509Z","end":"2014-08-19T18:47:24.668Z","likes":1,"posts":2,"comments":-1} diff --git a/casperjs/loveMachine.js b/casperjs/loveMachine.js index 69a5898..eb0a64d 100644 --- a/casperjs/loveMachine.js +++ b/casperjs/loveMachine.js @@ -132,12 +132,14 @@ var postStatus = function(){ var doSomeLove = function () { if( init ){ // this.echo('Init...'); - this.evaluate(function(){ + this.evaluate(function(strictMode){ window.likePosts = true; window.likeComments = true; window.nbPostLikes = 0; window.nbCommentLikes = 0; - }); + window.strictMode = strictMode; + }, + casper.cli.get('strictmode')); init = false; } if ( (nbPL >0 || nbCL > 0) && loop < maxLoop && numberOfPostLikes <= maxLikes ){ @@ -153,11 +155,17 @@ var doSomeLove = function () { if($(this).text() === 'Like'){ if( $(this).attr('id') === undefined || $(this).attr('id') === "" ){ - // If element doesn't have class "selected", which means it's already clicked - if ( !$(this).children('strong').hasClass('selected') && window.likePosts){ - $(this).attr('id', 'like' + window.nbPostLikes ); - console.log('Creating id="#like' + window.nbPostLikes + '"' ); - window.nbPostLikes++; + // If element doesn't have class "selected", which means it's already clicked + if ( !$(this).children('strong').hasClass('selected') && window.likePosts){ + var footer = $(this).parents("footer") + var body = footer.prevUntil("header"); + var a = body.find("a"); + var isApp = (a.attr('href').indexOf("apps.facebook.com") > -1); + if (!(isApp && window.strictMode)){ + $(this).attr('id', 'like' + window.nbPostLikes ); + console.log('Creating id="#like' + window.nbPostLikes + '"' ); + window.nbPostLikes++; + } } if ( window.likeComments && $(this).attr('title') === 'Like this comment' ){ $(this).attr('id', 'commentLike' + window.nbCommentLikes ); diff --git a/install.bat b/install.bat index 2656817..3b4ae76 100755 --- a/install.bat +++ b/install.bat @@ -1,5 +1,4 @@ setlocal ENABLEDELAYEDEXPANSION -set instdir=%cd% set psstart1="&{ start-process powershell -ArgumentList '-ExecutionPolicy RemoteSigned -noprofile -file set psstart2=\install.ps1' -verb RunAs}" set psstart=%psstart1% %cd%%psstart2% diff --git a/webdriver/loveMachine.py b/webdriver/loveMachine.py index cf54e19..ea9edfb 100644 --- a/webdriver/loveMachine.py +++ b/webdriver/loveMachine.py @@ -153,8 +153,8 @@ def updatePageStatus(webdriver, text): FIREFOX = True elif len(sys.argv) >= 3 : - LOGIN = sys.argv[-2:-1] - PASSWORD = sys.argv[-1:][0] + LOGIN = sys.argv[-3:-2] + PASSWORD = sys.argv[-2:][-1] options = sys.argv[1:-2] for i in range(len(options)):