get google suggested keywords in python

description: use python to get the keyword suggestion from google

codes for scraping google’s keywords

1
2
3
4
5
6
import requests, json
URL="http://suggestqueries.google.com/complete/search?client=firefox&q=google keywords"
headers = {'User-agent':'Mozilla/5.0'}
response = requests.get(URL, headers=headers)
result = json.loads(response.content.decode('utf-8'))
print(result)

result for crawling google keywords

1
['google keywords', ['google keywords', 'google keywords planner', 'google keywords free', 'google keywords analytics', 'google keywords planner tools', 'google keywords finder', 'google keywords youtube', 'google keywords api', 'google keywords search volume', 'google keywords everywhere']]