Introduction to pywhatkit module
Python offers numerous inbuilt libraries to ease our work. Among them pywhatkit is a Python library for sending WhatsApp messages at a certain time, it has several other features too.
Following are some features of pywhatkit module:
- Send WhatsApp messages.
- Play a YouTube video.
- Perform a Google Search.
- Get information on a particular topic.
The pywhatkit module can also be used for converting text into handwritten text images.
In Python3 pywhatkit module will not come pre-installed, so you can install it by using the command:
pip install pywhatkit
1. Send Whatsapp Messages:
Here, we will learn the simplest way of using pywhatkit module which utilises the WhatsApp webpage to automate messages sending to any number on WhatsApp. But make sure that you have logged into your WhatsApp in your browser.
Syntax: pywhatkit.sendmsg(“receiver mobile number”,”message”,hours,minutes)
- Receiver mobile number: The Receiver’s mobile number must be in string format and the country code must be mentioned before the mobile number.
- Message: Message to be sent(Must be in string format).
- Hours: This module follows the 24 hrs time format.
- Minutes: Mention minutes of the scheduled time for the message(00-59).
2. Play a YouTube video:
Function pywhatkit.playonyt(), opens the YouTube in your default browser and plays the video you mentioned in the function. If you pass the topic name as parameter, it plays the random video on that topic. On passing the URL of the video as the parameter, it open that exact video.
Syntax: pywhatkit.playonyt(“url/topic name”)
- URL/Topic Name: Mention the topic name or URL of the YouTube video
3. Perform Google Search:
You can perform a Google search using the following simple command. It opens your browser and searches for the topic you have given in your code.
- Keyword: It open your browser and performs search operation.
4. Get information on particular topic:
We can get brief information on a particular topic. We can also limit the number of lines to be printed. Also, make sure that you are searching for the topics that are available on Wikipedia.
- Topic: Gives the output on the topic mentioned.
- lines: It prints the searched topic in the specified number of lines.
Google LLC is an American multinational technology company that specializes in Internet-related services and products, which include online advertising technologies, a search engine, cloud computing, software, and hardware. It is considered one of the Big Four technology companies alongside Amazon, Apple and Microsoft.Google was founded in September 1998 by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University in California. Together they own about 14 percent of its shares and control 56 percent of the stockholder voting power through supervoting stock. They incorporated Google as a California privately held company on September 4, 1998, in California.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course