Skip to content

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");
See also  How to generate random numbers in Python?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.