Google has an amazing free API endpoint for text completions ,
below are some examples of the completions I got and the python code to interact with the API
Star this gist if this was helpful to you. Enjoy text completions
user@linux:$ python3 google_text_completion.py
> hackers are
hackers are watching you
> my hobbies are
my hobbies are travelling
import requests
import random
from fake_useragent import UserAgent
while True:
url = "https://www.google.com/complete/search"
params = {
"client": "firefox",
"hl": "en",
"q": input(' > '),
"output": "firefox"
}
response = requests.get(url, params=params, headers={
"User-Agent": UserAgent().random,
"Accept": "application/json",
"Accept-Language": "en-US,en;q=0.5",
"Referer": "https://www.google.com/",
"Connection": "keep-alive",
"TE": "Trailers"
})
suggestions = response.json()[1]
print(random.choice(suggestions))
```
Essaouira