Google Auto Suggest Scraper

Wilson Grant Fisk

Elite Member
Joined
Nov 10, 2012
Messages
15,677
Reaction score
46,846
Google_Auto_Suggest.gif



PHP:
# -*- coding: utf-8 -*-
import requests
import json

# here you include your main terms, this can be as many as you like
terms = ['wine']

# these are just 'variations' which are appended to the start of your 'terms'
variations = ['what * ', 'who * ', 'how * ', 'does * ', 'why * ', 'can * ', 'where * ', 'when * ']

for term in terms:
    for variant in variations:
        # request api
        r=requests.get('http://suggestqueries.google.com/complete/search?client=firefox&q={}{}'.format(variant, term))
        # grab returned text loading as json
        parsed_json = json.loads(r.text)
        # print each parsed item
        print parsed_json[0]
        for i in parsed_json[1]:
            print '- ', i.encode('utf-8', 'ignore')

Read more here: http://www.bronco.co.uk/our-ideas/content-topics/
 
For those who don't have experience with programming, this is made using python and you can read online how to install it and use it. If I'm not mistaken this script was made using python 2.7 but I could be wrong.
 
Back
Top