def __init__(self, facebook_id, facebook_auth_token): """ :param facebook_id: the users Facebook ID (can be gotten pretty easily) :param facebook_auth_token: the auth token used for tinder (Note: this requires more work to get but there are built in functions for that :) ) """ self.session = Session(facebook_id=facebook_id, facebook_token=facebook_auth_token)
with open("drake.txt","r") as f: drake = f.read().splitlines() def insult(): s_len = len(shake) d_len = len(drake) return "thou" + " " + shake[randint(0,1000)%s_len][0] + " " + shake[randint(0,1000)%s_len][1] + " " + shake[randint(0,1000)%s_len][2] + " " + drake[randint(0,1000)%d_len] def select_interactively(matches): N = len(matches) if N == 0: raise SystemExit("Please try with a different name") elif N == 1: return matches[0] selected = None while selected not in range(N): for i, m in enumerate(matches): print "[{i}]\t{n}\t(ID #{id})".format(i=i, n=m.user.name, id=m.user.id) print "Select one of the above listed matches" try: return matches[int(raw_input("> "))] except Exception as e: print e s = Session(ID, FB_TOKEN) clf=pickle.load(open(param_file)) for m in s.matches(): if m.messages != [] and clf.predict([str(m.messages)]) == "1": m.message(insult()) #print m.messages
while selected not in range(N): for i, m in enumerate(matches): print "[{i}]\t{n}\t(ID #{id})".format(i=i, n=m.user.name, id=m.user.id) print "Select one of the above listed matches" try: return matches[int(raw_input("> "))] except Exception as e: print e if __name__ == "__main__": ap = ArgumentParser(description="Dump the conversation with a match into CSV format") ap.add_argument("name", help="Name of match") args = ap.parse_args() s = Session(ID, FB_TOKEN) match = get_match(s.matches(), args.name) matches = [m for m in s.matches() if m.user is not None and m.user.name == args.name] match = select_interactively(matches, args.name) output_filename = datetime.datetime.now().strftime("%Y%m%d_%H%M%S_") + args.name + ".csv" with copen(output_filename, 'w') as fh: w = writer(fh) for m in match.messages: w.writerow([m._data['sent_date'], m.sender, m.body]) print "Wrote:", output_filename
n=m.user.name, id=m.user.id) print "Select one of the above listed matches" try: return matches[int(raw_input("> "))] except Exception as e: print e if __name__ == "__main__": ap = ArgumentParser( description="Dump the conversation with a match into CSV format") ap.add_argument("name", help="Name of match") args = ap.parse_args() s = Session(ID, FB_TOKEN) match = get_match(s.matches(), args.name) matches = [ m for m in s.matches() if m.user is not None and m.user.name == args.name ] match = select_interactively(matches, args.name) output_filename = datetime.datetime.now().strftime( "%Y%m%d_%H%M%S_") + args.name + ".csv" with copen(output_filename, 'w') as fh: w = writer(fh) for m in match.messages:
return matches[0] selected = None while selected not in range(N): for i, m in enumerate(matches): print("[{i}]\t{n}\t(ID #{id})".format(i=i, n=m.user.name, id=m.user.id)) print("Select one of the above listed matches") try: return matches[int(raw_input("> "))] except Exception as e: print(e) if __name__ == "__main__": ap = ArgumentParser(description="Dump the conversation with a match into CSV format") ap.add_argument("name", help="Name of match") args = ap.parse_args() s = Session(facebook_id=ID, facebook_token=FB_TOKEN) matches = [m for m in s.matches() if m.user is not None and m.user.name == args.name] match = select_interactively(matches, args.name) output_filename = datetime.datetime.now().strftime("%Y%m%d_%H%M%S_") + args.name + ".csv" with copen(output_filename, 'w') as fh: w = writer(fh) for m in match.messages: w.writerow([m._data['sent_date'], m.sender, m.body]) print("Wrote:", output_filename)
return matches[0] selected = None while selected not in range(N): for i, m in enumerate(matches): print "[{i}]\t{n}\t(ID #{id})".format(i=i, n=m.user.name, id=m.user.id) print "Select one of the above listed matches" try: return matches[int(raw_input("> "))] except Exception as e: print e if __name__ == "__main__": ap = ArgumentParser(description="Dump the conversation with a match into CSV format") ap.add_argument("name", help="Name of match") args = ap.parse_args() s = Session(ID, FB_TOKEN) matches = [m for m in s.matches() if m.user is not None and m.user.name == args.name] match = select_interactively(matches, args.name) output_filename = datetime.datetime.now().strftime("%Y%m%d_%H%M%S_") + args.name + ".csv" with copen(output_filename, 'w') as fh: w = writer(fh) for m in match.messages: w.writerow([m._data['sent_date'], m.sender, m.body]) print "Wrote:", output_filename
n=m.user.name, id=m.user.id) print "Select one of the above listed matches" try: return matches[int(raw_input("> "))] except Exception as e: print e if __name__ == "__main__": ap = ArgumentParser( description="Dump the conversation with a match into CSV format") ap.add_argument("name", help="Name of match") args = ap.parse_args() s = Session(facebook_id=ID, facebook_token=FB_TOKEN) matches = [ m for m in s.matches() if m.user is not None and m.user.name == args.name ] match = select_interactively(matches, args.name) output_filename = datetime.datetime.now().strftime( "%Y%m%d_%H%M%S_") + args.name + ".csv" with copen(output_filename, 'w') as fh: w = writer(fh) for m in match.messages: w.writerow([m._data['sent_date'], m.sender, m.body])