#https://www.bustabit.com/user/RandomBet import urllib.request from bs4 import BeautifulSoup import math from time import gmtime, strftime import datetime import time import cfscrape first_check_games = None first_check_net = None first_check_wasted = None first_check = False def check(): global first_check_games global first_check_net global first_check_wasted global first_check scraper = cfscrape.create_scraper() grab = scraper.get("https://www.bustabit.com/user/RandomBet").content soup = BeautifulSoup(grab, "lxml") username = soup.find('div', {"class":"content row panel radius"}).findAll('b') stats = soup.find('div', {"class":"content row panel radius"}).findAll('h5') if(username[0].get_text() == "RandomBet"): user = "BlackShadow" else: user = username[0].get_text() games = stats[0].get_text() rank = stats[1].get_text() gross = stats[2].get_text() net = stats[3].get_text() if(first_check == False): print("[" + user + "] - GAMES [" + games + "]", "RANK [" + rank + "]", "GROSS [" + gross + "]", "NET [" + net + "]" + "\n") format_net = int(float(net.replace(',', '').replace(' bits', ''))) statement = "[BITS" if(format_net < 0): statement = statement + " LOST] " else: statement = statement + " GAINED] " format_net = str(format_net).lstrip("-") average = 23 life_wasted = str(datetime.timedelta(seconds=(int(average) * int(games)))) if(first_check): print("\n" + "[SINCE FIRST CHECK] " + str((int(average) * int(games) - first_check_wasted)), "seconds of life lost.") else: first_check_games = games first_check_net = net first_check_wasted = int(int(average) * int(games)) first_check = True print(statement + str(round(int(format_net) / int(games), 2)), "per game.") print("[LIFE LOST] " + life_wasted, "or", str(int(average) * int(games)), "seconds.") def main(): while True: check() time.sleep(25) if __name__ == "__main__": main()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question