from pytube import Search
from tkinter.simpledialog import askstring
from webbrowser import WindowsDefault
chrome = WindowsDefault()
while True:
text = askstring("Search", "Search for a video")
if text == None:
break
chrome.open_new(Search(text).results[0].watch_url) |