黑五直接下单地址:
https://billing.virmach.com/cart.php?a=add&pid=175
import requests
import json
import re
import time
import sys
import winsound
settings = {
'price': 15,
'virt': 'KVM',
'ram': 2048,
'cpu': 2,
'hdd': 30,
'bw': 1500,
'ips': 1,
}
url = 'https://billing.virmach.com/modules/addons/blackfriday/new_plan.json'
def run():
response = json.loads(requests.get(url).text)
price = response['price']
if 'yr' in price:
price = float(re.findall('\$(.+?) <span>/yr</span>', price)[0])
virt = response['virt']
ram = int(response['ram'])
cpu = int(response['cpu'])
hdd = int(response['hdd'])
bw = int(response['bw'])
ips = int(response['ips'])
pid = response['pid']
location = response['location'] # BUFFALO
if price <= settings['price'] and virt == settings['virt'] and ram >= settings['ram'] and cpu >= settings[
'cpu'] and hdd >= settings['hdd'] and bw >= settings['bw'] and ips >= settings['ips']:
winsound.Beep(500, 1000)
print('$', price)
print(cpu, 'H', ram, 'M', bw, 'G')
print('hdd:', hdd, 'G')
if ips > 1:
print(ips)
print(location)
print('https://billing.virmach.com/cart.php?a=add&pid=' + str(pid))
else:
item = '无符合机器 ' + time.strftime("%H:%M:%S %Y-%m-%d", time.localtime())
sys.stdout.write('\r' + str(item) + '\033[K')
sys.stdout.flush()
while 1:
run()
time.sleep(5)