Advertisement
Guest User

Untitled

a guest
Nov 29th, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.21 KB | None | 0 0
  1. import urllib2
  2. import string
  3. import re
  4. import webbrowser
  5. import time
  6. import subprocess
  7. import sys
  8. import httplib
  9. import requests
  10. from requests_futures.sessions import FuturesSession
  11. from concurrent.futures import ThreadPoolExecutor
  12. from datetime import datetime
  13.  
  14.  
  15. startTime = datetime.now()
  16.  
  17. text_file1 = open("nikelink.txt", "r")
  18. results = text_file1.read()
  19. text_file1.close()
  20. url = results
  21. sock = urllib2.urlopen(url)
  22. sock = sock.read()
  23. sock = sock.decode('utf-8')
  24. sock1 = sock.encode('utf-8')
  25.  
  26. s = FuturesSession(executor=ThreadPoolExecutor(max_workers=5))
  27.  
  28. 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'}
  29.  
  30. 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'}
  31.  
  32. payload = {"login": "plimbimb1@gmail.com", "password": "Austinlee1"}
  33. payload1 = {"login": "jamesliaolee@gmail.com", "password": "Jameslee1"}
  34. payload2 = {"login": "plimbimb2@gmail.com", "password": "Austinlee1"}
  35.  
  36. r = s.post("https://www.nike.com/profile/login?Content-Locale=en_US", params=payload)
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. pattern = re.compile('<input type="hidden" name="action" value=".*"/>')
  50. patternA = pattern.findall(sock)
  51. patta = str(patternA)
  52. m = re.search('(?<=value=")\w+', patta)
  53.  
  54. if m:
  55. action = m.group(0)
  56.  
  57.  
  58. pattern2 = re.compile('<input type="hidden" name="lang_locale" value=".*"/>')
  59. patternB = pattern2.findall(sock)
  60. pattb = str(patternB)
  61. m1 = re.search('(?<=value=")\w+', pattb)
  62.  
  63. if m1:
  64. lang_locale = m1.group(0)
  65.  
  66.  
  67. pattern3 = re.compile('<input type="hidden" name="country" value=".*"/>')
  68. patternC = pattern3.findall(sock)
  69. pattc = str(patternC)
  70. m2 = re.search('(?<=value=")\w+', pattc)
  71.  
  72. if m2:
  73. country = m2.group(0)
  74.  
  75.  
  76. pattern4 = re.compile('<input type="hidden" name="catalogId" value=".*"/>')
  77. patternD = pattern4.findall(sock)
  78. pattd = str(patternD)
  79. m3 = re.search('(?<=value=")\w+', pattd)
  80.  
  81. if m3:
  82. catalogid = m3.group(0)
  83.  
  84.  
  85. pattern5 = re.compile('<input type="hidden" name="productId" value=".*"/>')
  86. patternE = pattern5.findall(sock)
  87. patte = str(patternE)
  88. m4 = re.search('(?<=value=")\w+', patte)
  89.  
  90. if m4:
  91. productid = m4.group(0)
  92. print (productid)
  93.  
  94. pattern6 = re.compile('<input type="hidden" name="price" value=".*"/>')
  95. patternF = pattern6.findall(sock)
  96. pattf = str(patternF)
  97. m5 = re.search('(?<=value=")\S+', pattf)
  98.  
  99. if m5:
  100. found5 = m5.group(0)
  101.  
  102. price = found5.split('"')[0]
  103.  
  104.  
  105.  
  106. pattern7 = re.compile('<input type="hidden" name="line1" value=".*"/>')
  107. patternG = pattern7.findall(sock)
  108. pattg1 = str(patternG)
  109. pattg = pattg1.replace(" ", "+")
  110.  
  111. m6 = re.search('(?<=value=")\S*', pattg)
  112.  
  113. if m6:
  114. found6 = m6.group(0)
  115.  
  116. line1 = found6.split('"')[0]
  117.  
  118.  
  119. pattern8 = re.compile('<input type="hidden" name="line2" value=".*"/>')
  120. patternH = pattern8.findall(sock)
  121. patth1 = str(patternH)
  122. patth2 = patth1.replace(" ", "+")
  123. patth = patth2.replace("&#x27;", "%27")
  124.  
  125. m6 = re.search('(?<=value=")\S*', patth)
  126.  
  127. if m6:
  128. found6 = m6.group(0)
  129.  
  130. line2 = found6.split('"')[0]
  131.  
  132.  
  133.  
  134. siteid = "null"
  135.  
  136. passcode = "null"
  137.  
  138. sizetype = "null"
  139.  
  140.  
  141. pattern10 = re.compile('".*:9.5"')
  142. patternalpha = pattern10.findall(sock)
  143. pattalpha = str(patternalpha)
  144.  
  145. mfinal = re.search('".*:', pattalpha)
  146.  
  147.  
  148. if mfinal:
  149. foundfinal = mfinal.group(0)
  150.  
  151. skucode1 = foundfinal.replace('"', '')
  152. skucode = skucode1.replace(':', '')
  153.  
  154.  
  155.  
  156. skuandsize = (skucode + "%3A9.5")
  157.  
  158.  
  159.  
  160.  
  161.  
  162. 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")
  163.  
  164.  
  165. link2 = ("http://expert.nike.com/pageupdate?vid=28df-19309b&pgid=3&tr=B&t=1406881743316")
  166.  
  167.  
  168. #t = s.post(link, headers=headers, cookies=cookie)
  169. #u = w.post(link, headers=headers, cookies=cookie)
  170.  
  171. xx = 0
  172. while xx < 500:
  173. xx += 1
  174. r = s.post("https://www.nike.com/profile/login?Content-Locale=en_US", params=payload)
  175. out111 = r.result()
  176. out12 = out111.content
  177. t = s.post(link, headers=headers, cookies=cookie)
  178. out11 = t.result()
  179. out1 = out11.content
  180. text_file1 = open("status1.txt", "w")
  181. text_file1.write(out1)
  182. text_file1.close()
  183. text_file2 = open("status1.txt", "r")
  184. results = text_file2.read()
  185. place = results
  186. text_file2.close()
  187. if results.find("wait") == -1:
  188. time.sleep(.001)
  189. else:
  190. patternpa = re.compile('"pil" :".*"')
  191. patternpb = patternpa.findall(place)
  192. pattpb = str(patternpb)
  193. m20 = re.search('\d+', pattpb)
  194. patternpz = re.compile('"psh" :".*"')
  195. patternpy = patternpz.findall(place)
  196. pattpy = str(patternpy)
  197. m21 = re.search('(?<=psh" :")\w+', pattpy)
  198. if m20:
  199. found20 = m20.group(0)
  200. if m21:
  201. found21 = m21.group(0)
  202. else:
  203. found21 = ("0")
  204. 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")
  205. xy = 0
  206. while xy < 100:
  207. xy += 1
  208. q = s.post(linkzz, headers=headers, cookies=cookie)
  209. out33 = q.result()
  210. out3 = out33.content
  211. text_file1 = open("status9.txt", "w")
  212. text_file1.write(out3)
  213. text_file2 = open("status9.txt", "r")
  214. results = text_file2.read()
  215. if results.find("success") == -1:
  216. print results
  217. time.sleep(5)
  218. else:
  219. print linkzz
  220. print ("item line has been added successfully")
  221. print (datetime.now()-startTime)
  222. sys.exit()
  223. if results.find("success") == -1:
  224. print "waiting to add to cart.."
  225. time.sleep(5)
  226. else:
  227. print ("Item added successfully")
  228. print (datetime.now()-startTime)
  229. sys.exit()
  230.  
  231.  
  232. #text_file1 = open("status1.txt", "w")
  233. #text_file1.write(out1)
  234. #text_file.close()
  235. #sys.exit()
  236.  
  237.  
  238.  
  239.  
  240.  
  241. #print patternz
  242. #text_file = open("nike.txt", "w")
  243. #text_file.write(sock1)
  244. #text_file.close()
  245. #sys.exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement