Menu

I asked Google 2,560 times: clustering 10,102 search suggestions
πŸ“°

I asked Google 2,560 times: clustering 10,102 search suggestions

DEV CommunityΒ·jiang WangΒ·about 11 hours ago
#1WIOIUuY
#dev#china#visa#enter#article
Reading 0:00
15s threshold

I wanted to know what people actually type before a trip to China. Not what I assumed, and not what travel blogs cover β€” what goes into the box.

Google does not sell that data cheaply. But it does hand out its autocomplete endpoint for free, and that endpoint returns the phrases real people typed, ordered by how often they type them.

So I scraped my own question into it.

The harvest

Three layers, about 2,560 requests:

# 1. seed phrases SEEDS = [ 'china' , 'china travel' , 'china visa' , 'china hotel' , 'china sim card' , . . . ]

# 2. question prefixes β€” this is where intent lives PREFIXES = [ 'how to' , 'how much' , 'can i' , 'do i need' , 'best' , 'cheapest' , . . . ]

# 3. alphabet soup on the shortest results for seed in top_50_shortest : for ch in 'abcdefghijklmnopqrstuvwxyz0123456789' : yield seed + ' ' + ch

Enter fullscreen mode

Exit fullscreen mode

def suggest ( q ) : url = f 'https://suggestqueries.google.com/complete/search?client=firefox&hl=en&gl=us&q={quote(q)}' return json .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.