Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. import requests
  2.  
  3. def findbums():
  4. league = "Havoc+Challenge+League+(PL4362)"
  5. realm = "pc"
  6. id = "1556123991345"
  7. url = "https://www.pathofexile.com/api/ladders"
  8. offset = 0
  9. limit = 200
  10. accounts = {}
  11.  
  12. for i in range(0, 43):
  13. r = requests.get("{0}?offset={1}&limit={2}&id={3}&type=league&realm={4}&_={5}"
  14. .format(url, offset, limit, league, realm, id))
  15. offset += limit
  16. json = r.json()
  17.  
  18. for j in range(0, limit):
  19. entry = json["entries"][j]
  20. name = entry["account"]["name"]
  21. alive = entry["dead"]
  22. level = entry["character"]["level"]
  23.  
  24. if name in accounts:
  25. if alive:
  26. accounts[name]["alive"].append(level)
  27. else:
  28. accounts[name]["dead"].append(level)
  29. else:
  30. accounts[name] = {
  31. "alive": [level] if alive else [],
  32. "dead": [] if alive else [level]
  33. }
  34.  
  35. bums = []
  36.  
  37. for account, data in accounts.items():
  38. if len(data["alive"]) == 0 and max(data["dead"]) < 30:
  39. bums.append(account)
  40.  
  41. print(bums)
  42. print(len(bums))
  43.  
  44.  
  45.  
  46. if __name__ == '__main__':
  47. findbums()
  48.  
  49.  
  50. Result:
  51.  
  52. ['arcolas', 'LoA89', 'dooshbagginss', 'PathOfReeep', 'FlyingZamboni', 'Bumbuys', 'Headpipe', 'steve2355', 'Flowing', 'Darkisss', 'OrangeGu', 'Seraaz', 'quasicat', 'guingo1', 'improvizatoric', 'Auditorium', 'KennyWuLee', 'AreYouLOX', 'MaddyDaddy', 'Evandrinde', 'dstfgh', 'LittleSallybow', 'SisterHell', 'ywt978', 'poolie147', 'decro024', 'Riznell123', 'gleb94gleb', 'Raydient', 'Timmiejj1', 'Lukazarra1', 'escylap']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement