random

- collection of un-sorted bollocks
git clone git://git.acid.vegas/random.git
Log | Files | Refs | Archive

buyvm.py (1320B)

      1 #!/usr/bin/env python
      2 # BuyVM inventory checker - developed by acidvegas in python (https://acid.vegas/random)
      3 
      4 ''' BuyVM servers go out of stock fast, this is a script to parse all the server availability '''
      5 
      6 import re,time,urllib.request
      7 
      8 nodes = {
      9 	'Las Vegas'  : '37',
     10 	'New York'   : '38',
     11 	'Luxembourg' : '39',
     12 	'Miami'      : '48'
     13 }
     14 
     15 while True:
     16 	for node in nodes:
     17 		data     = urllib.request.urlopen('https://my.frantech.ca/cart.php?gid=' + nodes[node]).read().decode()
     18 		packages = re.findall(r'<h3 class="package-name">(.+?)Available\n', data, re.I | re.M | re.S | re.U)
     19 		print(f'Servers in \033[34m{node}\033[0m:')
     20 		for server in packages:
     21 			name     = server.split('</h3>')[0].ljust(18)
     22 			price    = server.split('</span>')[1].split('<span ')[0].ljust(10)
     23 			features = server.split('<ul class="package-features"><li><b>')[1].split('</ul>')[0].split('NVME')[0]
     24 			for item in ('<li>','</li>','<b>','</b>'):
     25 				features = features.replace(item,'')
     26 			features = features.ljust(39)
     27 			stock    = server.split()[-1]
     28 			if stock == '0':
     29 				stock = f'\033[31m{stock}\033[0m'
     30 			else:
     31 				stock = f'\033[32m{stock}\033[0m'
     32 			print(f'{name} \033[1;30m|\033[0m {price} \033[1;30m|\033[0m {features} \033[1;30m|\033[0m {stock}')
     33 	time.sleep(3600)
     34 	print('--------------------------------------------------')