Play a Youtube video using pywhatkit in Python
The playonyt() function in pywhatkit module is used to play a Youtube video either from a URL or from a keyword.
Syntax
pywhatkit.playonyt("url/keywords", use_api, open_video); #use_api (optional, val = False) - Use web-API instead. #open_video (optional, val = True) - Opens video in your browser if set to True.
Advertisements
Example
//Plays Yummy by Justin Bieber pywhatkit.playonyt("https://www.youtube.com/watch?v=8EJ3zbKTWQ8"); pywhatkit.playonyt("Yummy Justin Bieber");