-
Notifications
You must be signed in to change notification settings - Fork 337
Miscellaneous Functions
Function: info(topic: str, lines: int = 3, return_value: bool = False) -> Optional[str]
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)
Function: playonyt(topic: str, use_api: bool = False, open_video: bool = True) -> Union[str, None]
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.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
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 PNG.
Example: pywhatkit.take_screenshot("myscreenshot")
Function: open_web() -> bool
This function is used to open WhatsApp Web. Returns True if it opened successfully otherwise False.
Example: pywhatkit.open_web()
Function: close_tab(wait_time: int = 2) -> None
Closes the currently active browser tab. The wait_time parameter specifies the time to wait before closing the tab.
PyWhatKit Version 5.2