import pyshorteners
import time

#Note that you need to get an api key for bit.ly, tiny.cc, and short.cm/io

print("Welcome to Url Shortener Central!")
time.sleep(1)
question = int(input("What url shortener source would you like to use?(tinyurl(1), bit.ly(2), tiny.cc(not working)(3), short.cm/io(not working)(4), or none): "))

if question == 1:
    url = input("Please paste in the url that you want to shorten: ")
    s = pyshorteners.Shortener()
    time.sleep(1)
    print("The url is being processed.")
    print("The shortened url will be given in 3 seconds.")
    time.sleep(1)
    print("{|||||||            }")
    time.sleep(1)
    print("{||||||||||||||     }")
    time.sleep(1)
    print("{|||||||||||||||||||}")
    print("The url has been processed!")
    print("The short url is ", s.tinyurl.short(url))
elif question == 2:
    url = input("Please paste in the url that you want to shorten: ")
    s = pyshorteners.Shortener(api_key = 'YOUR_KEY')
    time.sleep(1)
    print("The url is being processed.")
    print("The shortened url will be given in 3 seconds.")
    time.sleep(1)
    print("{|||||||            }")
    time.sleep(1)
    print("{||||||||||||||     }")
    time.sleep(1)
    print("{|||||||||||||||||||}")
    print("The url has been processed!")
    print("The short url is ", s.bitly.short(url))
elif question == 3:
    url = input("Please paste in the url that you want to shorten: ")
    s = pyshorteners.Shortener(api_key = 'YOUR_KEY', login = 'YOUR_USER')
    time.sleep(1)
    print("The url is being processed.")
    print("The shortened url will be given in 3 seconds.")
    time.sleep(1)
    print("{|||||||            }")
    time.sleep(1)
    print("{||||||||||||||     }")
    time.sleep(1)
    print("{|||||||||||||||||||}")
    print("The url has been processed!")
    time.sleep(2)
    print("UH OH! Something has gone wrong on our end. Please use another link shortener alternative.")
    print("The short url is ", s.tinycc.short(url))
elif question == 4:
    url = input("Please paste in the url that you want to shorten: ")
    s = pyshorteners.Shortener(api_key = 'YOUR_KEY')
    time.sleep(1)
    print("The url is being processed.")
    print("The shortened url will be given in 3 seconds.")
    time.sleep(1)
    print("{|||||||            }")
    time.sleep(1)
    print("{||||||||||||||     }")
    time.sleep(1)
    print("{|||||||||||||||||||}")
    print("The url has been processed!")
    time.sleep(2)
    print("UH OH! Something has gone wrong on our end. Please use another link shortener alternative.")
    print("The short url is ", s.shortcm.short(url))
else:
    print("You have typed an invalid response! Rerun the problem to use Url Shortener Central again!")
