Introduction
Pywhatkit is a Python library that allows you to perform various tasks like sending WhatsApp messages, playing YouTube videos, performing Google searches, & getting information on specific topics. It simplifies the process of automating these actions using simple Python commands.

In this article, we will explain the features of the pywhatkit module & learn how to use them with the help of examples.
Features of pywhatkit module
1. Send WhatsApp messages
Pywhatkit makes it easy to send WhatsApp messages using Python. You can automate the process of sending messages to a specific contact or group at a scheduled time.
Syntax
pywhatkit.sendwhatmsg(phone_no, message, time_hour, time_min)Parameters
- `phone_no`: The phone number of the recipient (with country code)
- `message`: The message you want to send
- `time_hour`: The hour at which you want to send the message (in 24-hour format)
- `time_min`: The minute at which you want to send the message
Example
import pywhatkit
pywhatkit.sendwhatmsg("+1234567890", "Hello, this is an automated message!", 10, 30)
This code will send the message "Hello, this is an automated message!" to the phone number "+1234567890" at 10:30 AM.
2. Play a YouTube video
With pywhatkit, you can play a YouTube video by providing the video URL or search query. It opens the video in your default web browser.
Syntax
pywhatkit.playonyt(video)Parameters
- `video`: The URL or search query of the YouTube video you want to play
Example
import pywhatkit
pywhatkit.playonyt("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
This code will open the YouTube video with the provided URL in your default web browser.
You can also use a search query instead of a URL:
pywhatkit.playonyt("Python tutorial for beginners")
This will perform a YouTube search for "Python tutorial for beginners" & play the first video from the search results.
3. Perform a Google Search
Pywhatkit allows you to perform a Google search using Python. It opens the search results in your default web browser.
Syntax
pywhatkit.search(query)Parameters
- `query`: The search query you want to perform on Google
Example
import pywhatkit
pywhatkit.search("What is Python programming?")
This code will open the Google search results for "What is Python programming?" in your default web browser.
You can use this feature to quickly search for information or find relevant websites related to a specific topic.
4. Get information on a particular topic
Pywhatkit provides a convenient way to retrieve information on a specific topic using the `info()` function. It fetches the summary of the topic from Wikipedia.
Syntax
pywhatkit.info(topic, lines)Parameters
- `topic`: The topic you want to get information about
- `lines`: The number of lines of information you want to retrieve (default is 4)
Example
import pywhatkit
pywhatkit.info("Python programming language", 5)
This code will retrieve 5 lines of information about the Python programming language from Wikipedia & display it in the console.
The `info()` function is useful when you need a quick summary or overview of a particular topic without having to search for it manually.




