Source code for python programs
Open the Web browser with speech recognition in python program
- Get link
- X
- Other Apps
Hi guys here you can build a program in python who open the web browser when you speak the program get the command and open the web browser you must enjoy it you can use in your program and add more functionality.
import speech_recognition as sr
import webbrowser
r1 = sr.Recognizer()
r2 = sr.Recognizer()
r3 = sr.Recognizer()
with sr.Microphone() as source:
print('[search shabdkosh: search youtube]')
print('speak now')
audio = r3.listen(source)
if 'youtube' in r2.recognize_google(audio):
r2 = sr.Recognizer()
url = f"https://www.youtube.com/results?search_query"
with sr.Microphone() as source:
print('search you query')
audio = r2.listen(source)
try:
get = r2.recognize_google(audio)
print(get)
webbrowser.get().open(url+get)
except sr.UnknownValueError:
print('Error')
except sr.RequestError as e:
print('failed'.format(e))
- Get link
- X
- Other Apps
Comments
Post a Comment