PDA

View Full Version : Need help with python script...



Accelerator
03-11-2014, 07:05 PM
So.. I found this script:
import urllib, urllib2, re, cookielib, os, time
from bs4 import BeautifulSoup
bidding = 1
def api():
def sniper():
url = "[Only registered and activated users can see links]" + str(id)
home = opener.open(url)
site = home.read()
html = BeautifulSoup(url)

try:
regular = re.compile("""<INPUT type="text" name="amount" value="(.*?)" size="6" maxlength="9">""")
idmatch = regular.search(site)
price = idmatch.group(1)
except:
print "Invalid ID."
raw_input()
sniper()


if int(price) > int(most):
print "Auction Price To High."
raw_input()
if 'Closed' in site:
print "Auction Closed Before Bidding."

regular = re.compile('''<INPUT type="hidden" name="_ref_ck" value="(.*?)">''')
idmatch = regular.search(site)
ref = idmatch.group(0)
ref = ref.replace('<INPUT type="hidden" name="_ref_ck" value="', '')
ref = ref.replace('">', '')


values = {'auction_id' : id, '_ref_ck' : ref, 'amount' : str(int(price) + 5)}
url = "[Only registered and activated users can see links]"
data = urllib.urlencode(values)
home = opener.open(url, data)
site = home.read()
base = BeautifulSoup(site)

while bidding > 0:
if 'Neopoints has been successfully added into the auction.' in site:
print "BID SUCCESSFUL."
time.sleep(.1)
sniper()
if 'Sorry, you are not allowed to bid' in site:
print "Tried To Bid Twice"
time.sleep(.1)
sniper()
if 'The current asking price for this item' in site:
print "Outbidded."
time.sleep(.1)
sniper()
if 'This auction is closed' in site:
print "Closed. Go See if Won."
raw_input()
api()


cj = cookielib.LWPCookieJar()
global opener
opener = urllib2.build_opener(urllib2.[Only registered and activated users can see links](c j))
opener.addheaders =[('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14')]

username = raw_input("UN: ")
password = raw_input("PW: ")

values = {'destination' : './', 'username' : username, 'password' : password}
url = '[Only registered and activated users can see links]'
request = urllib2.Request(url, data = urllib.urlencode(values))
home = opener.open(request)
site = home.read()

basecode = BeautifulSoup(site)
checker = basecode.find('td', attrs={'class':'user medText'})

np = basecode.find('a', href="/inventory.phtml").string.replace(',','')
try:
try:
nc = basecode.find('span', id="template_neocash_amt").string.replace(',','')
except AttributeError:
nc = basecode.find('a', href="/mall/index.phtml").string.replace(',','')
except AttributeError:
nc = "0"

if (re.search('Welcome, ', str(checker))) == None:
print 'Login Failed. Enter To Retry.'
raw_input()
os.system('cls')
api()

else:
print 'Login Success.'
print "NP: " + np
print "NC: " + nc
raw_input()
os.system('cls')
id = raw_input("Auction ID: ")
most = raw_input("Most To Spend: ")
sniper()


api()
The thing is, it bids every 1-2 seconds or so, how to make it bid faster?
Answer me via PM please.

Thanks in advance

DarkByte
03-11-2014, 07:39 PM
Remove time.sleep(.1) maybe... it should not delay by much though , but give it a whirl and let me know

Accelerator
03-11-2014, 07:48 PM
I've tried that before and i doesn't help :S
Any other ideas DarkByte ?

j03
03-11-2014, 08:00 PM
Your connection might be what's making it so slow...

Sent from my Nexus 5 using Tapatalk

Accelerator
03-11-2014, 09:33 PM
Your connection might be what's making it so slow...

Sent from my Nexus 5 using Tapatalk

I have 8Mbps, is that really slow?
I mean generally people in Per� have 2-4 Mbps :S

j03
03-11-2014, 09:48 PM
I have 8Mbps, is that really slow?
I mean generally people in Per� have 2-4 Mbps :S

Ah yeah you're kinda far from the neo-servers. That might be it..

Accelerator
03-12-2014, 12:42 PM
Oh, ok, thanks Joe (: