-
Notifications
You must be signed in to change notification settings - Fork 307
Miscellaneous Functions
info(topic: str, lines: int = 3, return_value: bool = False) -> str | None
This function is used to get the details of a topic using the Wikipedia API. The lines
parameter can be used to specify the number of lines to fetch. The return_value
parameter specifies whether the data fetched from the Wikipedia API should be returned or not.
Example: pywhatkit.info("Python Language", 10)
playonyt(topic: str, use_api: bool = False, open_video: bool = True) -> str
This function is used to play the most relevant YouTube Video associated with a Topic. If you are facing issues with this function like malformed URL's you can set the use_api
parameter to be True
, this uses the PyWhatKit playonyt API to fetch the Video URL. open_video
is used to specify that whether or not you want the video to be opened.
Example: pywhatkit.playonyt("Python", True)
(if you want to use the API) or
pywhatkit.playonyt("Python")
(Without API)
search(topic: str) -> None
This function is used to search google for a specific topic and then open's a new browser tab to the search result page.
Example: pywhatkit.search("Python")
show_history() -> None
This function shows the history of all the messages that have been sent using this library.
Example: pywhatkit.show_history()
take_screenshot(file_name: str = "pywhatkit_screenshot", delay: int = 2) -> None
Only for MacOS and Windows.
This function is used to take a screenshot, you can change the name of the output file. The saved file will be in the PNG format. The delay
parameter is used to set the delay after which the screenshot will be taken.
Example: pywhatkit.take_screenshot("myscreenshot")
open_web() -> bool
This function is used to open WhatsApp Web. Returns True if it opened successfully otherwise False.
Example: pywhatkit.open_web()
PyWhatKit Version 5.2