search-google import lib if not present
This commit is contained in:
@@ -3,7 +3,13 @@ import sys
|
||||
import argparse
|
||||
from time import sleep
|
||||
import random
|
||||
|
||||
try:
|
||||
from googlesearch import search
|
||||
except ImportError:
|
||||
subprocess.check_call([sys.executable, "-m", "pip", "install", "googlesearch-python"])
|
||||
from googlesearch import search
|
||||
|
||||
|
||||
def google_search(query, num_results):
|
||||
# Effectuer une recherche Google et récupérer les 5 premiers résultats
|
||||
|
||||
Reference in New Issue
Block a user