diff --git a/Voice Assistant.py b/Voice Assistant.py index 72b52a1..2db7211 100644 --- a/Voice Assistant.py +++ b/Voice Assistant.py @@ -12,6 +12,8 @@ import requests import pyaudio +import pyttsx3 // this module was used before importing + @@ -95,10 +97,24 @@ def takeCommand(): webbrowser.open_new_tab("gmail.com") speak("Google Mail open now") time.sleep(5) - elif "shoping" in statement: + elif "shopping" in statement or "purchase" in staement or "buy" in statement: speak("nice mood sir") webbrowser.open("amazon.com") speak("here you are sir") + + + # adding functionality to open System programs like notepad etc + + # It assumes that the path of notepad is set in Environment variables + # to set the path, press windows icon, search for notepad, then on right hand + # side, click on open file location, then it will open the path to shortcut of + # notepad program in your system, again right click, and select open file + # location, the copy its path and set a new environment variable, with + # variable name -> Notepad + # variable value -> path copied in above steps + elif "notepad" in statement or "texteditor" in statement: + speak("Opening notepad for you") + os.system(Notepad) elif "weather" in statement: diff --git a/newsfinal.py b/newsfinal.py new file mode 100644 index 0000000..584a83e --- /dev/null +++ b/newsfinal.py @@ -0,0 +1,16 @@ +import requests +from bs4 import BeautifulSoup + + +def get_headlines(url): + info = {'text': [], + 'link': []} + resp = requests.get(url) + soup = BeautifulSoup(resp.text, 'html.parser') + for line in soup.findAll('span', {'class': 'w_tle'}): + info['text'].append(line.text) + link = line.find('a')['href'] + if link[0]=='/': + link = 'https://timesofindia.indiatimes.com' + link + info['link'].append(link) + return info \ No newline at end of file