You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rankcheck.py 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #Welcome to SaltyRank, a tool to check your rank on saltybet.com from terminal
  2. from lxml import html
  3. import requests
  4. import getpass
  5. #If you prefer not to enter your password every time simply change the lines below so they read
  6. #EMAIL = "your email"
  7. #PWORD = "your password"
  8. EMAIL = raw_input("What is your email? ")
  9. PWORD = getpass.getpass("Enter your password: ")
  10. LOGIN_URL = "http://www.saltybet.com/authenticate?signin=1"
  11. URL = "http://www.saltybet.com"
  12. def main():
  13. session_requests = requests.session()
  14. # Get login csrf token
  15. result = session_requests.get(LOGIN_URL)
  16. tree = html.fromstring(result.text)
  17. signin = list(set(tree.xpath("//input[@name='authenticate']/@value")))[0]
  18. # Create payload
  19. payload = {
  20. "email": EMAIL,
  21. "pword": PWORD,
  22. "authenticate": signin
  23. }
  24. # Perform Login
  25. result = session_requests.post(LOGIN_URL, data = payload, headers = dict(referer = LOGIN_URL))
  26. # Scrape rank data from navbar span
  27. result = session_requests.get(URL, headers = dict(referer = URL))
  28. tree = html.fromstring(result.content)
  29. rank_number = tree.xpath('//span[@id="leaderboardRank"]/text()')
  30. print "%s" % rank_number
  31. if __name__ == '__main__':
  32. main()