def getFreebies(usr, pwd): global freebies NeoLogger.login(usr, pwd) shopMoney = 0#re.findall(r'You currently have <b>(\d+) NP</b> in your till.', opener.open('http://www.neopets.com/market.phtml?type=till').read())[0] for url in freebies: try: page = urllib2.urlopen(url[0], None, 5) if(re.findall(url[2], page.read())): print url[1], "get!" ## else: ## print "Derped up during", url[1], ":" except urllib2.HTTPError: print url[1], "request failed!"
("http://www.neopets.com/desert/shrine.phtml?type=approach", "Coltzan", ''), ("http://www.neopets.com/altador/council.phtml?prhv=18af1a7eb9cd3c2e3c5f42483d11def8&collect=1", "Altador", ''), #("http://www.neopets.com/process_bank.phtml?type=interest", "Bank", ''), #("http://www.neopets.com/process_market.phtml?type=withdraw&amount="+str(shopMoney), "Shop Till", r''), ("http://www.neopets.com/freebies/index.phtml", "Monthly Freebee", '')] def getFreebies(usr, pwd): global freebies NeoLogger.login(usr, pwd) shopMoney = 0#re.findall(r'You currently have <b>(\d+) NP</b> in your till.', opener.open('http://www.neopets.com/market.phtml?type=till').read())[0] for url in freebies: try: page = urllib2.urlopen(url[0], None, 5) if(re.findall(url[2], page.read())): print url[1], "get!" ## else: ## print "Derped up during", url[1], ":" except urllib2.HTTPError: print url[1], "request failed!" def stock(): stock = urllib2.urlopen('http://www.neopets.com/quickstock.phtml') stock = re.findall('</TR>.+</TR>', stock.read()) print stock #return stock if __name__ == '__main__': NeoLogger.login() # getFreebies()
import NeoLogger import urllib2 opener = NeoLogger.login('jdong42', 'qwerty123') urllib2.install_opener(opener) gameURL = 'http://www.neopets.com/games/hidenseek/1.phtml?xfn=' print urllib2.urlopen(gameURL).read() a = 'http://www.neopets.com/games/process_hideandseek.phtml?p=4&game=1' print urllib2.urlopen(a).read() ## ##for n in range(1, 3):#11): ## a = urllib2.urlopen('http://www.neopets.com/games/process_hideandseek.phtml?p='+str(n)+'&game=1') ## print a.read()