repl.it
@Pythonier/

Cycle Finder

Python

No description

fork
loading
Files
  • main.py
  • Packager files
  • poetry.lock
  • pyproject.toml
  • requirements.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import urllib.request, replit,time,sys
from bs4 import BeautifulSoup
from colors import green,cyan,red

def write(string):
  for char in string:
    sys.stdout.write(char)
    sys.stdout.flush()
    time.sleep(.03)
replit.clear()

played = input("Have you used this before? y/n\n")
if played == 'y':
  replit.clear()
else:
  write("By entering your username the code will find out how many cycles you have.")
  time.sleep(2)
replit.clear()
username = input("What is your username?\n")
try:
  while True:
    link = "https://repl.it/@" + username
    page = urllib.request.urlopen(link)

    soup = BeautifulSoup(page, 'html.parser')

    cycles = soup.find('span', attrs={'title': 'cycles'})
    cycles = cycles.text[1:-1]
    replit.clear()
    usernameC = username[0].upper()
    usernameR = username[1:len(username)]
    username = (usernameC + usernameR)

    print(cyan(username) + " has " + green(cycles) + " cycles so far.\n" + red("Note: This page is live and will continue to update regularly."))
  
except:
  print(red("That username doesn't exist!"))
?