Advertisement
Guest User

Untitled

a guest
Aug 7th, 2021
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.50 KB | None | 0 0
  1. import pyperclip as py
  2. import requests
  3. import math
  4. import keyboard as kb
  5. import time
  6.  
  7. while True:
  8.     if kb.is_pressed('control') & kb.is_pressed('c'):
  9.         try:
  10.             url = 'https://poe.ninja/api/data/currencyoverview?league=Expedition&type=Currency'
  11.             time.sleep(0.05)
  12.             clipboard = py.paste()
  13.             currency = str(clipboard.split('\n')[2][:-1])
  14.             currency_amount = int(clipboard.split('\n')[4][12:-4])
  15.             currency_amount = int(clipboard.split('\n')[4][12:-4])
  16.  
  17.             r = requests.get(url).json()
  18.             for i in range(0, len(r['lines'])):
  19.                 if (r['lines'][i]['currencyTypeName']) == currency:
  20.                     sale_price = currency_amount * float(r['lines'][i]['receive']['value'])
  21.                     sale_price_floor = math.floor(sale_price)
  22.                     print(r['lines'][i]['currencyTypeName'])
  23.                     print("Value: " + str(r['lines'][i]['receive']['value']) + " Chaos")
  24.                     print("Available to sell: " + str(currency_amount))
  25.                     print("Sale price rounded down: " + str(math.floor((sale_price))) + " Chaos")
  26.                     print(str(sale_price_floor) + "/" + str(currency_amount) + " Copied to clipboard")
  27.                     print("---------------------------------------\n")
  28.                     py.copy(str(sale_price_floor) + "/" + str(currency_amount))
  29.             time.sleep(1)
  30.         except Exception as e:
  31.             print(e)
  32.             time.sleep(1)
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement