Skip to content

Commit 25fb948

Browse files
author
SimionPutina
committed
cleanup
1 parent 8b716d8 commit 25fb948

13 files changed

+24
-196
lines changed

AI/predictor.py

-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
#good/bad
1919
identifiers = ['G', 'B']
20-
2120
source = glob.glob("../2ndacc/testing/*")
2221
print source;
2322
counter = 0
@@ -41,15 +40,11 @@ def predict(self, source):
4140

4241
# good/bad
4342
identifiers = ['G', 'B']
44-
45-
print source;
4643
testing = imread(source, 1)
4744
testing = imresize(testing, (200, 200))
4845
hog_features = hog(testing, orientations=12, pixels_per_cell=(16, 16),
4946
cells_per_block=(1, 1))
5047
result_type = clf.predict(hog_features)
5148
# i[18:-4] - only id part of the filename
52-
#print "source in predictor is: " + source
5349
Image.open(source).save('2ndacc/AIResults/svmHOG1/' + str(identifiers[result_type]) + source[9:-4] + ".jpg")
54-
#print source[9:-4]
5550
return str(identifiers[result_type])

AI/test.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,15 @@
99
from PIL import Image
1010
import scipy.misc
1111
import warnings
12+
1213
warnings.filterwarnings(action="ignore", category=DeprecationWarning)
1314
names = "http://images.gotinder.com/55f5f20482f96dff09d79380/7bfbe387-55e0-46bb-ab35-cef3ca3a6536.jpg"
14-
names2 = "http://images.gotinder.com/577040ea19c4986f1250320c/6d9498f1-7967-4912-9e7a-6d32be8150eb.jpg"
15-
names3 = "http://images.gotinder.com/57310df1d6290d1a1a7e5be8/d05a163a-1179-4bff-8a80-23633b0e3b2b.jpg"
16-
17-
1815
#print names[27:51]
19-
#print names2[27:51]
20-
#print names3[27:51]
2116

2217
# good/bad
2318
identifiers = ['G', 'B']
2419

2520
source = glob.glob("../2ndacc/testing/*")
26-
print source;
2721
counter = 0
2822
for i in source:
2923
testing = imread(i, 1)
@@ -32,8 +26,6 @@
3226
cells_per_block=(1, 1))
3327
result_type = identifiers[0]
3428
print i[18:-4]
35-
#Image.open(i).save('../2ndacc/AIResults/svmHOG/' + str(identifiers[result_type]) + i[18:-3] + ".jpg")
36-
3729
counter += 1
3830

3931

AI/train_svm.py

-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
good = glob.glob("./../2ndacc/good/*")
3030
bad = glob.glob("./../2ndacc/bad/*")
3131

32-
print good
3332
data = []
3433
labels = []
3534
good_data = []
@@ -40,17 +39,13 @@
4039
image = imresize(image, (200, 200))
4140
hog_feat = hog(image, orientations=12, pixels_per_cell=(16,16), cells_per_block=(1,1))
4241
data.append(hog_feat)
43-
#good_data.append(image.ravel())
44-
#good_labels.append
4542
labels.append(0)
4643

4744
for i in bad:
4845
image = imread(i, 1)
4946
image = imresize(image, (200, 200))
5047
hog_feat = hog(image, orientations=12, pixels_per_cell=(16,16), cells_per_block=(1,1))
5148
data.append(hog_feat)
52-
#good_data.append(image.ravel())
53-
#good_labels.append
5449
labels.append(1)
5550

5651
print ' training svm'

AI/train_svm_ravel.py

-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from scipy.misc import imread
88
from sklearn.svm import LinearSVC
99
from scipy.misc import imread,imsave,imresize
10-
1110
import numpy as np
1211
import os
1312
import itertools
@@ -25,11 +24,9 @@
2524
import matplotlib
2625
import pickle
2726

28-
2927
good = glob.glob("./../2ndacc/good/*")
3028
bad = glob.glob("./../2ndacc/bad/*")
3129

32-
print good
3330
data = list()
3431
labels = list()
3532
good_data = []
@@ -38,24 +35,17 @@
3835
for i in range(len(good)):
3936
for filename in good[i]:
4037
image = imread(i, 1)
41-
#image = imresize(image, (200, 200))
4238
imr = image.ravel()
4339
data.append(imr)
44-
#good_data.append(image.ravel())
45-
#good_labels.append
4640
labels.append(0)
4741

4842
for i in range(len(bad)):
4943
for filename in bad[i]:
5044
image = imread(i, 1)
51-
#image = imresize(image, (200, 200))
5245
imr = image.ravel()
5346
data.append(imr)
54-
#good_data.append(image.ravel())
55-
#good_labels.append
5647
labels.append(1)
5748

58-
print ' training svm'
5949
clf = LinearSVC(dual=False, verbose=1)
6050
clf.fit(data, labels)
6151
pickle.dump(clf, open("svmravel.detector", "wb"))

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
Uses machine learning to learn your type of people on tinder, and then autonomously swipes for you.
44
Collects instagrams accounts which you can mass-follow if you wish to do so.
55
Able to view all of your friends* tinder accounts.
6-
Able to only swipe right the people who already swiped right on you.
6+
Able to only swipe right the people who already swiped you by spoofing locations.
77

88
inspiration and API documentation by the beautiful [Alex Reed](https://github.com/0xdeafcafe)

correct_fn.py

+1-19
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
config = utils.read_file('CONFIG.cfg').splitlines()
1212
fbToken = config[0]
1313
fbID = config[1]
14-
print "fbtoken is " + str(fbToken)
15-
16-
1714
source = glob.glob("2ndacc/to_correct/*")
15+
1816
ids = []
1917
profiles = []
2018
print source
@@ -28,46 +26,30 @@
2826
for id in ids:
2927
if id in line:
3028
profiles.append(str(id) + " " + str(utils.get_url(line)))
31-
#print "found one - " + str(id) + " url is " + str(utils.get_url(line))
32-
#print lines[9:33]
33-
#print profiles
34-
3529

3630
def initialize():
3731
url = 'https://api.gotinder.com/auth'
3832
headers = {'Content-Type': 'application/json', 'User-Agent': 'Tinder/4.8.2 (iPhone; iOS 9.1; Scale/2.00)'}
3933
payload = {'force_refresh': 'False', 'facebook_id': fbID, 'facebook_token': fbToken}
4034
r = requests.post(url, headers=headers, data=json.dumps(payload))
41-
#print r.text
4235
rjson = json.loads(r.text)
43-
print "token is: " + rjson['token']
4436
return rjson['token']
4537

4638
tinder_token = initialize()
47-
48-
49-
#print 'token is: ' + str(fbToken)
50-
#print 'fbid is: ' + str(fbID)
51-
52-
53-
5439
tinder_headers = {'X-Auth-Token': tinder_token,
5540
'Authorization': 'Token token="{0}"'.format(tinder_token).encode('ascii', 'ignore')
5641
}
57-
print tinder_headers
5842

5943
for profile in profiles:
6044
try:
6145
current = profile.split(' ')
62-
#current0 = id, current1 = link to first pic
6346
link = 'https://api.gotinder.com/like/{0}'.format(current[0])
6447
liking_header = {'X-Auth-Token': tinder_token,
6548
'Authorization': 'Token token="{0}"'.format(tinder_token).encode('ascii', 'ignore'),
6649
'firstPhotoID': ''+str(current[1])
6750
}
6851
likereq = requests.get(link, headers = liking_header)
6952
print 'status: ' + str(likereq.status_code) + ' text: ' + str(likereq.text)
70-
print str(current[0]) + " " + str(current[1])
7153
except Exception as ex:
7254
print "hit an exception i guess"
7355
print ex

getimages.py

+1-10
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,10 @@
1616
folder = "ladies/"
1717
counter = 0
1818
name = folder + str(counter)
19-
20-
21-
#urllib.urlretrieve("http://images.gotinder.com/5553606c7edc79cb1fa8ad5a/18d73531-3dc5-438e-9e21-52b4d5271dcc.jpg", "name")
2219
links = re.findall(regexRule, liked)
23-
#print links
20+
2421

2522
for link in links:
26-
#save with id as the name
2723
urllib.urlretrieve(link, folder+link[27:51]+extension)
2824
counter+=1
2925
name = folder + str(counter)+round+extension
@@ -33,8 +29,3 @@
3329
if (round != "Z"):
3430
with open("identifier.txt", "w") as text_file:
3531
text_file.write(roundIdentifier[roundIdentifier.index(round)+1])
36-
37-
38-
print ""
39-
#print newS
40-
#print type(newS)

instadick.py

+1-19
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,5 @@
55

66

77
access_token = "2260798150.5029a98.aa136b2cc1aa4367b51e8ce753f1e308"
8-
#r = requests.get("https://instagram.com/oauth/authorize/?client_id=5029a98b04474633aae46fffe2d8e6c6&redirect_uri=http://localhost:6379/oauth_callback&response_type=token")
9-
#print r.text
10-
#print r.url
11-
128
r = requests.get("https://api.instagram.com/v1/users/search?q=laura&access_token=2260798150.5029a98.aa136b2cc1aa4367b51e8ce753f1e308")
13-
print r.text
14-
print r.text[3]
15-
out = json.loads(r.text)
16-
#print out['data'][0]['username']
17-
print out
18-
19-
20-
21-
# req = urllib2.urlopen("https://instagram.com/oauth/authorize/?client_id=5029a98b04474633aae46fffe2d8e6c6&redirect_uri=http://localhost:6379/oauth_callback&response_type=token")
22-
# print req.geturl()
23-
# print req.info()
24-
# print req.response.read()
25-
26-
27-
#2260798150.5029a98.aa136b2cc1aa4367b51e8ce753f1e308
9+
out = json.loads(r.text)

0 commit comments

Comments
 (0)