From b7ef1dd38c5fa6ba1a37b7424c1dccb169e9a859 Mon Sep 17 00:00:00 2001 From: acidvegas Date: Mon, 24 Jul 2023 16:36:24 -0400 Subject: [PATCH] Added buyvm monitoring script --- buyvm.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 buyvm.py diff --git a/buyvm.py b/buyvm.py new file mode 100644 index 0000000..724f994 --- /dev/null +++ b/buyvm.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# BuyVM inventory checker - developed by acidvegas in python (https://acid.vegas/random) + +''' BuyVM servers go out of stock fast, this is a script to parse all the server availability ''' + +import re,time,urllib.request + +nodes = { + 'Las Vegas' : '37', + 'New York' : '38', + 'Luxembourg' : '39', + 'Miami' : '48' +} + +for node in nodes: + data = urllib.request.urlopen('https://my.frantech.ca/cart.php?gid=' + nodes[node]).read().decode() + packages = re.findall(r'

(.+?)Available\n', data, re.I | re.M | re.S | re.U) + print(f'Servers in \033[34m{node}\033[0m:') + for server in packages: + name = server.split('

')[0].ljust(18) + price = server.split('')[1].split('
  • ')[1].split('')[0].split('NVME')[0] + for item in ('
  • ','
  • ','',''): + features = features.replace(item,'') + features = features.ljust(39) + stock = server.split()[-1][0] + if stock == '0': + stock = f'\033[31m{stock}\033[0m' + else: + stock = f'\033[32m{stock}\033[0m' + print(f'{name} \033[1;30m|\033[0m {price} \033[1;30m|\033[0m {features} \033[1;30m|\033[0m {stock}') +