Record a pitiful Python script to snap up a cheap mobile phone experience!

I accidentally browsed to the official website of Meizu and said that the Meizu 3 is limited to 100 units. Snap on the 30th at 12 noon. It just so happens that my claw machine is currently in a state of being scrapped, so I will try my luck. At 11 o'clock, I habitually looked at the script of the webpage, and found the ajax that detects whether it is time for panic buying and returns the message of panic buying. So write a python script. After all, we have to go to dinner at 12 o'clock.

Record a pitiful Python script to snap up a cheap mobile phone experience!

Record a pitiful Python script to snap up a cheap mobile phone experience!

import sys,urllib2,json,random,webbrowser

buyurl = 'http://store.meizu.com/topic/twelve/go/'+ str(random.random())

print buyurl

buydata = urllib2.urlopen(buyurl)

print buydata

jd = json.loads(str(buydata))

if (jd["value"] != None):

webbrowser.open_new_tab(jd["value"])

3 lines to build a random connection, use urllib2 to get the returned json. Then parse the Value, and this Value is returned to the processing python code analysis, and if it is not empty, it will jump over. It is estimated that after reaching the point, a url is sent. Then, if successful, I use webbroswer to create a browser tab, and then

Just buy it. Because it was snapped up before 12 o'clock. I wrote a batch by hand. This has no technical content.

@echo off

:loop

buy.py

goto loop

It is to continuously execute the python script in a loop.

But the heartbreak thing came. Before 12:00, Meizu cut off the news of the interface. After more than 20 minutes are in a state of disconnection. The buddies who helped to rob can't be opened in Shandong, Hunan, Beijing and other places. After 20 minutes, it returned to the original price snap-up page, saying that it had been snapped up. Is this a pit? ? ? ? Hey. .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325889712&siteId=291194637