Skip to content

Instantly share code, notes, and snippets.

@maxgillett
Created August 26, 2015 04:23
Show Gist options
  • Save maxgillett/fdfc857a78360be81901 to your computer and use it in GitHub Desktop.
Save maxgillett/fdfc857a78360be81901 to your computer and use it in GitHub Desktop.
JSwipe Bot
import sys
import json
import argparse
from time import sleep
from random import randint
from datetime import datetime
import requests
headers = {
'Host': 'api.parse.com',
'Accept': 'application/json',
'Proxy-Connection': 'keep-alive',
'X-Parse-Session-Token': '###',
'X-Parse-Application-Id': '###',
'Accept-Encoding': 'gzip, deflate',
'Content-Type': 'application/json; charset=utf-8',
'Content-Length': '232',
'User-Agent': 'jswipe/6 (iPhone; iOS 8.4; Scale/2.00)',
'Connection': 'keep-alive',
'X-Parse-REST-API-Key': '###'
}
def recommendations():
h = headers
r = requests.post('https://api.parse.com/1/functions/getNextUsersToSwipe', headers=h)
if r.status_code == 401 or r.status_code == 504:
raise Exception('Invalid code')
print r.result
if not 'result' in r.json():
print r.json()
objectIds = [result['user']['objectId'] for result in r.json()['result']]
return objectIds
def save_swipes(objectIds):
h = headers
swipes = [{"didLike": True, "userID": objectId, "wasMatch": True} for objectId in objectIds]
req = requests.post(
'https://api.parse.com/1/functions/saveSwipes',
headers=h,
data = json.dumps({"swipes": swipes})
)
print objectIds
print req.json()
while True:
objectIds = recommendations()
save_swipes(objectIds)
s = float(randint(5000, 15000) / 1000.)
sleep(s)
@asaf050
Copy link

asaf050 commented Jul 20, 2017

They are still using parse?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment