## Sunday, March 16, 2014

### Tinder autoliker

Tinder is an app that is a recent craze among dating apps. It is good because it is simple and before you know it you are chatting with potential partner. That's the theory. In practice, like every dating app it is overloaded with males and suffers from shortage of females. This means that males need to like many many girls before they get a match. In fact better strategy is to just like every girl and then discard the ones you don't like once you get a match. But that means that you need to very annoyingly keep on clicking like for entire day. Well, not anymore...

To save my phone's battery and preserve mobility, I spawned an android emulator (part of standard android SDK). I downloaded Tinder 2.2.1 SDK from the web and installed the app by issuing:

adb install tinder-apk-file


which almost got me a working tinder app except, it was stuck at finding matches screen. After a bit of digging and thinking about possible reasons I realized it's missing a location. This could be fixed by issuing:

telnet localhost 5554

and then typing:

geo fix longtitude latitude

Where latitude and longtitude can be obtained for example here . Don't forget to check that you got the right spot by typing where am i in Google on emulator. After that's done we have a working tinder app on emulator and all we need to do is simulate touches, which can be done by monkeyrunner (in tools directory in android sdk). I was originally using this script but I modified it to randomize click time and click location in case Tinder did some bot detection. To run the script simply type: (sometimes you will get Java errors - just run it second time, they will be resolved):

./monkeyrunner your-script.py

Below is a simple demo:

Good luck and have fun!

1. Could you share your final script?

2. OK, so here's monkeyrunner script, your home work is to work out how to run it! :)
# Run this script using Monkeyrunner.

import commands
import time
import random
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice

def click(device, x, y):
device.touch(x, y, MonkeyDevice.DOWN_AND_UP)

def n(mu, sigma, integer=False, nonzero=False):
x = random.gauss(mu, sigma)
if nonzero:
x = max(0, x)
if integer:
x = int(x)
return x

def restartTinder(device):
print "restarting tinder"
device.press('KEYCODE_HOME', MonkeyDevice.DOWN_AND_UP)
time.sleep(2)
print "should be in menu now"
package = 'com.tinder'
activity = 'com.tinder.activities.ActivitySplash_'
runComponent = package + '/' + activity
device.startActivity(component=runComponent)
time.sleep(3)
print "done"

def main():
device = MonkeyRunner.waitForConnection()
restartTinder(device)
while True:
click(device, n(800, 5, integer=True), n(1600, 5, integer=True))
time.sleep(n(1, 0.2, nonzero=True))

if __name__ == '__main__':
main()

1. second homework is apparently indentation....

2. ok fine there you go: http://pastebin.com/HFFrP0s1

3. Thanks! I just run it with monkeyrunner from the command line - ez pz :D

1. Sure. Good luck on your future endaevors! ;)

4. still struggling to run this script i get the following error:

140430 17:28:27.710:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] Scri
pt terminated due to an exception
140430 17:28:27.710:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]Synta
xError: ("mismatched input ' ' expecting EOF", ('C:\\Program Files\\Android\\
adt-bundle-windows-x86-20140321\\sdk\\tools\\autolike.py', 3, 4, ' import com
mands\n'))

140430 17:28:27.710:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
140430 17:28:27.710:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
140430 17:28:27.710:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
at org.python.core.Py.compile_flags(Py.java:1731)
140430 17:28:27.710:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
at org.python.core.__builtin__.execfile_flags(__builtin__.java:514)
140430 17:28:27.710:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:225)
140430 17:28:27.710:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
at com.android.monkeyrunner.ScriptRunner.run(ScriptRunner.java:116)
140430 17:28:27.710:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
at com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.java:77)

140430 17:28:27.710:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:18
9)

can you help?. Also will it work on any emulator? im using Bluestacks.

1. Not sure what bluestacks is, I am using standard emulator that comes with andorid sdk.

Looking at your exception I think either your setup is just broken, or maybe you are using windows newlines instead of linux newlines, which is probably what the monkeyrunner is expecting. I am not a windows expert but try using notepad++ for editing your code that might solve the issue.

2. you're right! i am using windows! But i have no idea what you mean by "newlines" and as for editing the code?! :s (i wasn't even aware i needed to edit it!...). So my questions are:

What is Newlines?
what parts in the code do i need to edit?

3. Newlines are characters that you computer recognizes as end of the line and start of another. If you ever programmed in HTML "
" is a newline. If in C++ or something similar then you are probably familiar with "\n".

Basically you need to open the code in notepad++ and save it. If that's not helping make sure notepad++ is set up so that it inserts linux newlines. To quickly verify you did it right, open the code in normal windows notepad and it should look all screwed up (because Windows notepad does not recognize Linux newlines).

All that being said even if you managed to do what I said I am not 100% sure it will resolve your issue.

If you have further problems, please post your question on stackoverflow.com (feel free to post link to your question in comment though - if I find some time I will try to answer it).

Good luck!

5. This comment has been removed by the author.

6. this is amazing. i am a beginner and getting into android programming, and this is really helpful, i have learned a lot already. unfortunately i cannot get it running. it does everything fine but when it comes to the touch event, it throws an error. can you help me out with this?

[...]

1. Whats the output of