def deletethread(threadid, username, receiverid): didntmsgbacklist = OkCupid.getlist('./Lists/DidntMsgBack.txt') didntmsgbacklist.append(username) OkCupid.writelisttofile('./Lists/DidntMsgBack.txt', didntmsgbacklist) body = { 'deletethread' : 'DELETE', 'mailaction' : '3', 'buddyname' : username, 'r1' : username, 'threadid' : threadid, 'receiverid' : receiverid, 'folderid' : '2', 'body_to_forward' : ''} data = urllib.urlencode(body) delurl = 'http://www.okcupid.com/mailbox?readmsg=true&threadid=' + threadid + '&folder=2' delrequest = urllib2.Request(delurl, data, OkCupid.cookiedict) delrespon = urllib2.urlopen(delrequest)
def deletethread(threadid, username, receiverid): didntmsgbacklist = OkCupid.getlist('./Lists/DidntMsgBack.txt') didntmsgbacklist.append(username) OkCupid.writelisttofile('./Lists/DidntMsgBack.txt', didntmsgbacklist) body = { 'deletethread': 'DELETE', 'mailaction': '3', 'buddyname': username, 'r1': username, 'threadid': threadid, 'receiverid': receiverid, 'folderid': '2', 'body_to_forward': '' } data = urllib.urlencode(body) delurl = 'http://www.okcupid.com/mailbox?readmsg=true&threadid=' + threadid + '&folder=2' delrequest = urllib2.Request(delurl, data, OkCupid.cookiedict) delrespon = urllib2.urlopen(delrequest)
def savelists(): OkCupid.writelisttofile(listpath, sendmsgsto) OkCupid.writelisttofile("./Lists/SentAMessage.txt", sentamessage)
if __name__ =='__main__': maindir = os.getcwd() queries = json.load(open('queries.json')) for query in queries: filterout = [] for i in query['filterout'] filterout += OkCupid.getlist(i.encode("utf-8")) currentlist = OkCupid.getlist(query['filepath'].encode("utf-8")) while True: print(query['name'].encode("utf-8") + ' List Count: ' + str(len(currentlist))) matched = [] matchcount = 0 #url manipulation code #currenturl = query['queryurl'].encode("utf-8") #re.sub('timekey=[0-9]', '', url) #&low=501&count=50 potentials = getpageusernames(query['queryurl'].encode("utf-8")) for potential in potentials: if potential in filterout: continue else: matchcount += 1 matched.append(potential) filterout.append(potential) currentlist = currentlist + matched currentlist.sort() OkCupid.writelisttofile(query['filepath'].encode("utf-8"), currentlist) if matchcount == 0: break