import search import makeLink import display #user input anime = input('Search anime: ') #search function results = search.search(anime) #display results num = 0 print('Results:') for result in results: num += 1 print(str(num) + ' - ' + result) #selecting anime while True: pick = input('Select anime entering its number: ') if pick.isnumeric(): if int(pick) <= num and int(pick) > 0: url = makeLink.ani_link(results[int(pick)-1]) break else: print('Invalid number `-´') else: print("That's not a number `-´") #episodes while True: eps = search.episodes(url) ep_sel = input(results[int(pick)-1] + ' has ' + eps + ' episodes. Select the episode u want to watch: ') if ep_sel.isnumeric(): if int(ep_sel) <= int(eps) and int(ep_sel) > 0: epi = int(ep_sel) link = makeLink.ep_link(url, ep_sel) break else: print('Invalid number `-´') else: print("That's not a number `-´") #display def showtime(link): vido = display.get_vid(link) display.display(vido[-1]) return vido #stores the different hosts in case the default one doesn't work servers = showtime(link) #options while True: res = input("""\np to watch previous episode d to pick a different host n to watch next episode q to quit: """) #quits if res.lower() == 'q': print('cya') break #previous episode elif res.lower() == 'p': if epi == 1: print('Error! This is the first episode') elif res.lower() == 'n': epi += 1 if epi > int(eps): print('Error! This is the last episode') else: link = makeLink.ep_link(url, epi) showtime(link) #diff host elif res.lower() == 'd': j = 0 for x in servers: j += 1 print('Server ' + str(j)) host = input('Pick the host: ') if host.isnumeric(): if int(host) > 0 and int(host) < j: ref = servers[int(host)] display.display(ref) continue else: print('Invalid number') else: print('not a number sadly') else: print("That wasn't an option dude")