Skip to content

Miscellaneous Functions

aryan edited this page Jun 7, 2021 · 29 revisions

Function: info(topic: str, lines: int = 3) -> 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.

Example: pywhatkit.info("Python Language", 10)

Function: playonyt(topic: str, use_api: bool = False) -> str def open_web() -> bool:

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.

Example: pywhatkit.playontyt("Python", use_api = True) (if you want to use the API)

Function: search(topic: str) -> None

This function is used to search google for a specific topic and then open's a new browser to the search result page.

Function: show_history() -> None

This function shows the history of all the messages that have been sent using this library.

Function: take_screenshot(file_name: str = 'pywhatkit_screenshot') -> None

This function is used to take a screenshot, you can change the name of the output file. The saved file will be PNG.

Example: pywhatkit.take_screenshot("myscreenshot")

Function: def open_web() -> bool

This function is used to open WhatsApp Web. Returns True if it opened successfully otherwise False.

Example: pywhatkit.open_web()

Clone this wiki locally