Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib2
- import string
- import re
- import webbrowser
- import time
- import subprocess
- import sys
- import httplib
- import requests
- from requests_futures.sessions import FuturesSession
- from concurrent.futures import ThreadPoolExecutor
- from datetime import datetime
- startTime = datetime.now()
- text_file1 = open("nikelink.txt", "r")
- results = text_file1.read()
- text_file1.close()
- url = results
- sock = urllib2.urlopen(url)
- sock = sock.read()
- sock = sock.decode('utf-8')
- sock1 = sock.encode('utf-8')
- s = FuturesSession(executor=ThreadPoolExecutor(max_workers=5))
- headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2107.3 Safari/537.36', 'Host': 'secure-store.nike.com', 'Connection': 'keep-alive', 'Referer': url, 'Accept-Encoding': 'gzip,deflate', 'Accept-Language': 'en-US,en;q=0.8'}
- cookie = {'RES_TRACKINGID': '849445096449926', 'RES_SESSIONID': '905512340366840', 'AnalysisUserId': '128.999.77.22.1405689197999243', 'WRUID': '999997038.176257895', 'AKNIKE': 'aaaU7Y_RwjGvd9fnDJr9XSPidl715aSZs0uylTgXzcHxT2VFBj4hVOw', 'USID': '0EA26227358182A1AEACC9C39CABDEAF.sin-197-app-us-1', 'guidS': '030ca47a-4f90-4894-a8ad-70f7f4a96550', 'guidU': '5b2f32fc-91b7-4e8d-e2e1-1e733e171917', 'utag_main': '_st:1406883408970$ses_id:1406881306602%3Bexp-session', 'needlepin': 'N190d1405448840085428df001c216777a328777900add77900fd1001900000000000001177900b9e0000000009usrunning01177900bc72ea0000', '_unam': 'c0158ee-1474310f9da-28ebb10-1'}
- payload = {"login": "plimbimb1@gmail.com", "password": "Austinlee1"}
- payload1 = {"login": "jamesliaolee@gmail.com", "password": "Jameslee1"}
- payload2 = {"login": "plimbimb2@gmail.com", "password": "Austinlee1"}
- r = s.post("https://www.nike.com/profile/login?Content-Locale=en_US", params=payload)
- pattern = re.compile('<input type="hidden" name="action" value=".*"/>')
- patternA = pattern.findall(sock)
- patta = str(patternA)
- m = re.search('(?<=value=")\w+', patta)
- if m:
- action = m.group(0)
- pattern2 = re.compile('<input type="hidden" name="lang_locale" value=".*"/>')
- patternB = pattern2.findall(sock)
- pattb = str(patternB)
- m1 = re.search('(?<=value=")\w+', pattb)
- if m1:
- lang_locale = m1.group(0)
- pattern3 = re.compile('<input type="hidden" name="country" value=".*"/>')
- patternC = pattern3.findall(sock)
- pattc = str(patternC)
- m2 = re.search('(?<=value=")\w+', pattc)
- if m2:
- country = m2.group(0)
- pattern4 = re.compile('<input type="hidden" name="catalogId" value=".*"/>')
- patternD = pattern4.findall(sock)
- pattd = str(patternD)
- m3 = re.search('(?<=value=")\w+', pattd)
- if m3:
- catalogid = m3.group(0)
- pattern5 = re.compile('<input type="hidden" name="productId" value=".*"/>')
- patternE = pattern5.findall(sock)
- patte = str(patternE)
- m4 = re.search('(?<=value=")\w+', patte)
- if m4:
- productid = m4.group(0)
- print (productid)
- pattern6 = re.compile('<input type="hidden" name="price" value=".*"/>')
- patternF = pattern6.findall(sock)
- pattf = str(patternF)
- m5 = re.search('(?<=value=")\S+', pattf)
- if m5:
- found5 = m5.group(0)
- price = found5.split('"')[0]
- pattern7 = re.compile('<input type="hidden" name="line1" value=".*"/>')
- patternG = pattern7.findall(sock)
- pattg1 = str(patternG)
- pattg = pattg1.replace(" ", "+")
- m6 = re.search('(?<=value=")\S*', pattg)
- if m6:
- found6 = m6.group(0)
- line1 = found6.split('"')[0]
- pattern8 = re.compile('<input type="hidden" name="line2" value=".*"/>')
- patternH = pattern8.findall(sock)
- patth1 = str(patternH)
- patth2 = patth1.replace(" ", "+")
- patth = patth2.replace("'", "%27")
- m6 = re.search('(?<=value=")\S*', patth)
- if m6:
- found6 = m6.group(0)
- line2 = found6.split('"')[0]
- siteid = "null"
- passcode = "null"
- sizetype = "null"
- pattern10 = re.compile('".*:9.5"')
- patternalpha = pattern10.findall(sock)
- pattalpha = str(patternalpha)
- mfinal = re.search('".*:', pattalpha)
- if mfinal:
- foundfinal = mfinal.group(0)
- skucode1 = foundfinal.replace('"', '')
- skucode = skucode1.replace(':', '')
- skuandsize = (skucode + "%3A9.5")
- link = ("https://secure-store.nike.com/us/services/jcartService?callback=jQuery1720123107630247855558991_1397536250233&action=" + action + "&lang_locale=" + lang_locale + "&country=" + country + "&catalogId=" + catalogid + "&productId=" + productid + "&price=" + price + "&siteId=" + siteid + "&line1=" + line1 + "&line2=" + line2 + "&passcode=" + passcode + "&sizeType=" + sizetype + "&skuAndSize=" + skuandsize + "&qty=1&rt=json&view=3&skuId=" + skucode + "&displaySize=9.5&_=1397536308748")
- link2 = ("http://expert.nike.com/pageupdate?vid=28df-19309b&pgid=3&tr=B&t=1406881743316")
- #t = s.post(link, headers=headers, cookies=cookie)
- #u = w.post(link, headers=headers, cookies=cookie)
- xx = 0
- while xx < 500:
- xx += 1
- r = s.post("https://www.nike.com/profile/login?Content-Locale=en_US", params=payload)
- out111 = r.result()
- out12 = out111.content
- t = s.post(link, headers=headers, cookies=cookie)
- out11 = t.result()
- out1 = out11.content
- text_file1 = open("status1.txt", "w")
- text_file1.write(out1)
- text_file1.close()
- text_file2 = open("status1.txt", "r")
- results = text_file2.read()
- place = results
- text_file2.close()
- if results.find("wait") == -1:
- time.sleep(.001)
- else:
- patternpa = re.compile('"pil" :".*"')
- patternpb = patternpa.findall(place)
- pattpb = str(patternpb)
- m20 = re.search('\d+', pattpb)
- patternpz = re.compile('"psh" :".*"')
- patternpy = patternpz.findall(place)
- pattpy = str(patternpy)
- m21 = re.search('(?<=psh" :")\w+', pattpy)
- if m20:
- found20 = m20.group(0)
- if m21:
- found21 = m21.group(0)
- else:
- found21 = ("0")
- linkzz = ("https://secure-store.nike.com/us/services/jcartService?callback=jQuery1720123107630247855558991_1397536250233&action=" + action + "&lang_locale=" + lang_locale + "&country=" + country + "&catalogId=" + catalogid + "&productId=" + productid + "&price=" + price + "&siteId=" + siteid + "&line1=" + line1 + "&line2=" + line2 + "&passcode=" + passcode + "&sizeType=" + sizetype + "&skuAndSize=" + skuandsize + "&qty=1&rt=json&view=3&skuId=" + skucode + "&displaySize=9.5" + "&pil=" + found20 + "&psh=" + found21 + "&_=1397536308748")
- xy = 0
- while xy < 100:
- xy += 1
- q = s.post(linkzz, headers=headers, cookies=cookie)
- out33 = q.result()
- out3 = out33.content
- text_file1 = open("status9.txt", "w")
- text_file1.write(out3)
- text_file2 = open("status9.txt", "r")
- results = text_file2.read()
- if results.find("success") == -1:
- print results
- time.sleep(5)
- else:
- print linkzz
- print ("item line has been added successfully")
- print (datetime.now()-startTime)
- sys.exit()
- if results.find("success") == -1:
- print "waiting to add to cart.."
- time.sleep(5)
- else:
- print ("Item added successfully")
- print (datetime.now()-startTime)
- sys.exit()
- #text_file1 = open("status1.txt", "w")
- #text_file1.write(out1)
- #text_file.close()
- #sys.exit()
- #print patternz
- #text_file = open("nike.txt", "w")
- #text_file.write(sock1)
- #text_file.close()
- #sys.exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement