beng 大佬有话说 : 2019-11-29 17:28:22
VIRMACH 只需付款的全自动脚本 selenium+chrome
1. 抢购的配置等于或高于你的配置要求
2.声音提示
3.自动加入购物车,只需听到提示音付款,全自动
4.需要安装好requests和 selenium
需要修改的地方:
1.settings按照自己要求修改
2.chromedriver下载对应版本
driver = webdriver.Chrome(executable_path=’E:Work Areachromedriver.exe’, options=options)中executable_path换成你自己的
import requests
import json
import re
import time
import sys
import winsound
from selenium import webdriver
settings = {
‘price’: 15,
‘virt’: ‘KVM’,
‘ram’: 2000,
‘cpu’: 2,
‘hdd’: 20,
‘bw’: 1000,
‘ips’: 1,
}
url = ‘https://billing.virmach.com/modules/addons/blackfriday/new_plan.json’
options = webdriver.ChromeOptions()
options.add_argument(‘–incognito’)
options.add_argument(‘–disable-gpu’)
driver = webdriver.Chrome(executable_path=’E:Work Areachromedriver.exe’, options=options)
driver.get(‘https://www.baidu.com’)
def run():
response = json.loads(requests.get(url).text)
price = response[‘price’]
if ‘yr’ in price:
price = float(re.findall(‘$(.+?) <span>/yr</span>’, price))
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’]:
driver.get(‘https://billing.virmach.com/cart.php?a=add&pid=’ + str(pid))
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))
return True
else:
item = ‘无符合机器 ‘ + time.strftime("%H:%M:%S %Y-%m-%d", time.localtime())
sys.stdout.write(‘r’ + str(item) + ‘