Mon code python google search ne fonctionne pas

Dorian -  
 noplou - 15 sept. 2022 à 21:14

Bonjour,

J'ai écrit un code python qui me sert a faire des recherches google, mais quand me programme me dit de dire ma recherche, la recherche ne se lance pas.

Quelqu'un pourrez m'aider s'il vous plaît ? 

def recherche():
    talk("Que voulez-vous rechercher ?")
    engine.runAndWait()
    with sr.Microphone() as source:
        print("Dites votre recherche")
        voice = listener.listen(source)
        command = listener.recognize_google(voice, language="fr-FR")
        command = command.lower()
        print(command)
        if "opale" in command:
            command = command.replace("opale", "")
        print(command)
    mySearch = input()
    webbrowser.open("https://www.google.com/search?q=" + mySearch)
A voir également:

1 réponse

yg_be Messages postés 23538 Date d'inscription   Statut Contributeur Dernière intervention   Ambassadeur 1 581
 

bonjour,

es-tu certain de nous avoir montré tout ton code?

0
Dorian
 

oui je l'ai joint avec, je le remet ci-dessous :

def recherche():
    with sr.Microphone() as source:
        print("Dites votre recherche")
        voice = listener.listen(source)
        command = listener.recognize_google(voice, language="fr-FR")
        command = command.lower()
        print(command)
        if "opale" in command or "recherche pour moi" in command:
            command = command.replace("opale", "")
            print(command)
        mySearch = input()
        webbrowser.open("https://www.google.com/search?q=" + mySearch)
    return command
0
noplou > Dorian
 

Bonsoir, il n'y a forcément pas tout, puisque tu utilises des bibliothèques additionnelles, de plus on ne sait comment est appelée cette fonction.

1