py
#!/usr/bin/python
# coding=utf-8
import time
import random
import requests
import json
def run():
while True:
url = 'https://app.cloudcone.com/blackfriday/offers' # cc 链接
url2 = "https://app.cloudcone.com/ajax/vps" # 返回结果链接
try:
req_header = {
"Host": "app.cloudcone.com"
"Sec-Fetch-Dest": "empty"
"Sec-Fetch-Mode": "cors"
"Sec-Fetch-Site": "same-origin"
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/83.0.4103.97 Safari/537.36"
"X-Requested-With": "xmlHttpRequest"
"Cookie": "替换自己"
}
response = requests.get(url req_header)
html1 = str(response.content "utf-8")
jsondata = json.loads(html1)['__data']['vps_data']
for num in jsondata:
if jsondata[num]['usd_price'] < 12: # 小于多少刀才抢
payload = {'os': '1007'
'hostname': 'baidu.com'
'location': '2'
'plan': num
'method': 'provision'
'_token': '替换自己'
}
response = requests.post(url2 headers=req_header data=payload timeout=3)
if response.status_code == 200:
print(response.text)
except Exception as e:
print(e.__str__())
continue
#time.sleep(2.5*random.randint(2 10))
if __name__ == '__main__':
run()
正文完
发表至: 开源脚本
2023-01-25