Jarvis in English Part 5


 VIDEO:- 



CODE :- 

1. Temperature

 elif "temperature" in query:
    search = "temperature in delhi"
    url = f"https://www.google.com/search?q={search}"
    r  = requests.get(url)
    data = BeautifulSoup(r.text,"html.parser")
    temp = data.find("div", class_ = "BNeawe").text
    speak(f"current{search} is {temp}")
elif "weather" in query:
    search = "temperature in delhi"
    url = f"https://www.google.com/search?q={search}"
    r  = requests.get(url)
    data = BeautifulSoup(r.text,"html.parser")
    temp = data.find("div", class_ = "BNeawe").text
    speak(f"current{search} is {temp}")

2. Time

elif "the time" in query:
    strTime = datetime.datetime.now().strftime("%H:%M")    
    speak(f"Sir, the time is {strTime}")


No comments:

Post a Comment