跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • virmach 筛选脚本 python版
未分類
25 2 月 2020

virmach 筛选脚本 python版

beng 大佬有话说 : 2019-11-29 16:55:40

virmach 筛选脚本 python版

本帖最后由 beng 于 2019-11-29 17:06 编辑

功能:
1.按个人要求筛选匹配条件[修改settings即可]
2.声音提醒功能
3.自动生成购物车链接
4.无第三方库,是python就能跑

等等再写个Selenium+chrome的脚本 全自动

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))
    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) + ‘33[K’)
      sys.stdout.flush()

while 1:
    run()
    time.sleep(5)

hotkk 大佬有话说 : 2019-11-29 16:56:13

大佬牛逼,支持了

文将 大佬有话说 : 2019-11-29 16:56:59

大佬,能否加上机房位置的筛选呢

陆伯言 大佬有话说 : 2019-11-29 16:57:21

是必须要完全一致才会提醒还是低于就可以

beng 大佬有话说 : 2019-11-29 16:58:00

陆伯言 大佬有话说 : 2019-11-29 16:57
是必须要完全一致才会提醒还是低于就可以

配置高于或等于就行

tonyma 大佬有话说 : 2019-11-29 16:59:06

陆伯言 大佬有话说 : 2019-11-29 16:57
是必须要完全一致才会提醒还是低于就可以

看代码,就是大于的时候,很简单,随便自定义呀

pangyuxing 大佬有话说 : 2019-11-29 17:00:38

大佬,第35行漏了一个 ‘

taian 大佬有话说 : 2019-11-29 17:00:44

支持!谢谢分享。

fenghuang 大佬有话说 : 2019-11-29 17:01:19

这个不错 可以比较

qq272810532 大佬有话说 : 2019-11-29 17:01:43

大佬,运行提示没有requests这个模块

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具