Sub topic 13
Limits, terms of use, and responsible collection
This chapter assumes you have read the earlier chapters on autocomplete expansion and the short collection script. It also assumes you can read basic Python and know what an HTTP status code is. You already know how to expand a seed into many ideas. Here you learn what these sources cannot tell you, what rules apply when you collect from them, and how to keep your collection small and defensible.
What the data cannot tell you
Autocomplete and People also ask (PAA) show what Google chooses to display. They are not a complete record of searches. Five limits matter in practice.
- No volume. A suggestion appearing means it is plausible and often popular, but it gives no search count. Two suggestions can differ in demand by a factor of a thousand.
- No ranking meaning you can rely on. The order of suggestions reflects Google's prediction for that moment and context. It is not a published popularity order.
- Filtering. Google removes some predictions, such as ones that violate its policies or that it considers harmful. A missing suggestion does not mean nobody searches for it.
- Instability. Suggestions and PAA boxes change over days and weeks. A snapshot is true only for the date, place, and language where you took it.
- Selection bias. Alphabet expansion and modifier lists find what your method can reach. Ideas that need an unusual phrasing never surface.
Treat every collected item as a candidate to validate, not as a finding. The validation chapter covers checking the SERP and a separate volume source.
Terms of use and the unofficial endpoint
Collecting by hand, one query at a time in a browser, is ordinary use of a search engine. Collecting by script is different.
- The suggestion endpoint used in the earlier script is undocumented. Google has not promised it will keep working, keep its format, or stay open to scripts.
- Google's terms of service restrict automated access to its services. Google's robots rules and spam policies also address automated queries. Read the current terms yourself, because they change and this chapter cannot replace them.
- Scraping the full results page, including PAA boxes, is more sensitive than fetching suggestions. It involves parsing HTML that changes often, and it is the activity most likely to trigger blocking.
- Your own terms matter too. If you work for a client or employer, check whether policy allows automated collection from a third party's service.
Be aware of the practical side of enforcement. Excess traffic usually produces CAPTCHAs, HTTP 429 (too many requests) or 403 (forbidden) responses, or a temporary block on your IP address. Repeated abuse can affect everyone on a shared network.
Choosing the right collection method
Decide how you will collect before you write any code. The options trade effort, reliability, and risk.
| Method | Effort | Reliability | Terms risk |
|---|---|---|---|
| Type queries by hand and copy results | High per idea | High | Lowest |
| Browser tool that reads what you already see | Medium | Medium | Low to medium |
| Script against the suggestion endpoint | Low | Low, can break anytime | Medium |
| Script that scrapes the results page | Medium | Very low | Highest |
| Licensed SEO tool or API with suggestion data | Low | High | Low, covered by the vendor's terms |
For most projects, a few dozen hand-typed seeds and one modest script run are enough. If you need thousands of queries on a regular schedule, a licensed tool is usually the more honest choice. The vendor carries the collection risk and the data comes with a documented format.
Collecting responsibly
If you do run a script, follow a small set of habits. They reduce the load you create and the chance of being blocked.
- Set a request budget before you start. Decide the maximum number of requests, for example 50, and stop when you reach it.
- Pause between requests. One to two seconds is a minimum. A fixed pause is better than none, and a random pause is better than a fixed one.
- Cache every answer. Never ask the same question twice. A cache also lets you stop and resume without repeating work.
- Stop when asked to stop. On a 403 or 429 response, end the run. Do not retry in a loop, rotate IP addresses, or fake browser identities to get around a block. That behavior is evasion, and it is the point where a minor terms issue becomes a real problem.
- Identify your tool honestly. Set a clear User-Agent string that names your script. Do not impersonate a browser.
- Collect only what you need. Fetch the suggestions for the seeds you actually plan to use, not every letter combination you can think of.
- Keep personal data out. Autocomplete is usually generic, but if you ever log queries from real users, handle them under your privacy obligations.
The following version of the collector builds these habits in. It uses a disk cache, a budget, a delay, and a hard stop on blocking responses.
import json
import time
from pathlib import Path
import requests
SUGGEST_URL = "https://suggestqueries.google.com/complete/search"
CACHE_FILE = Path("suggest_cache.json")
MAX_REQUESTS = 50
DELAY_SECONDS = 2
HEADERS = {"User-Agent": "keyword-research-notes/1.0 (small manual study)"}
class StopCollecting(Exception):
"""Raised when the budget is spent or the server asks us to slow down."""
def load_cache():
if CACHE_FILE.exists():
return json.loads(CACHE_FILE.read_text(encoding="utf-8"))
return {}
def save_cache(cache):
CACHE_FILE.write_text(json.dumps(cache, indent=2), encoding="utf-8")
def polite_suggest(query, cache, budget, language="en"):
key = f"{language}|{query}"
if key in cache:
return cache[key] # no request needed
if budget["used"] >= MAX_REQUESTS:
raise StopCollecting("request budget used up")
time.sleep(DELAY_SECONDS)
budget["used"] += 1
response = requests.get(
SUGGEST_URL,
params={"client": "firefox", "q": query, "hl": language},
headers=HEADERS,
timeout=10,
)
if response.status_code in (403, 429):
raise StopCollecting(f"server refused with status {response.status_code}")
response.raise_for_status()
suggestions = response.json()[1]
cache[key] = suggestions
return suggestions
def main():
cache = load_cache()
budget = {"used": 0}
results = {}
try:
for query in ["cold brew", "cold brew vs", "how cold brew"]:
results[query] = polite_suggest(query, cache, budget)
except StopCollecting as reason:
print(f"Stopped early: {reason}")
finally:
save_cache(cache) # keep what we already fetched
print(f"Requests used: {budget['used']}")
for query, suggestions in results.items():
print(query, "->", suggestions)
if __name__ == "__main__":
main()Running it a second time makes zero requests for the queries already cached. The finally block saves the cache even when the run stops early, so no fetched answer is wasted.
What to do when collection stops working
Because the endpoint is unofficial, failure is a normal event, not a surprise. Expect these cases and decide your response in advance.
- Status 429 or 403. Stop. Wait at least several hours, and lower your budget next time.
- Empty or changed response. The JSON shape may have changed. Check one query by hand in the browser before assuming your code is wrong.
- CAPTCHA page returned instead of JSON. The
response.json()call will raise an error. Treat this as a block, not a bug to retry. - Different results than the browser. Language, region, and personalization differ between a script and your signed-in browser. Record the
hlvalue you used and compare like with like.
Documenting your method
Record how you collected so someone else, or you in six months, can judge the data. Keep a short note beside the spreadsheet with these fields.
- Date of collection and the tool or script version
- Language and country settings used
- Whether you were signed in, and whether you used a private window
- The seed list and the expansion patterns applied
- The number of requests made and whether the run ended early
This note also protects you. If someone questions why a keyword is missing or why results differ from theirs, you can answer from the record.
Common mistakes
- Treating the absence of a suggestion as proof of no demand.
- Running alphabet expansion on dozens of seeds in one sitting without a budget.
- Retrying immediately after a 429 response.
- Scraping PAA boxes at scale with a script because "the data is visible anyway".
- Reporting suggestion counts as if they were search volumes.
- Skipping the cache, then repeating identical requests while debugging.
Exercise
A colleague's script sends 26 alphabet-expansion requests for each of 40 seeds with no delay, no cache, and retries any failure up to five times. Name three changes that would make it more responsible, and say what the script should do on the first 429 response.
Show answer
Add a pause between requests (at least one to two seconds), add a cache so repeated queries are never re-sent, and set a request budget (for example, cut the seed list or run in smaller batches over several days). Other valid changes are an honest User-Agent and removing the retry loop. On the first 429 response the script should stop, save its cache, and wait hours before trying again, not retry or work around the block.
Exercise
You collected 300 suggestions for a seed. A teammate says the one listed first is the most searched. Give two reasons this conclusion is not safe, and name what you would use instead.
Show answer
Suggestion order is Google's prediction for a given moment, place, language, and account, so it is not a published popularity ranking. The data also contains no search counts, and Google filters some predictions. Validate with the SERP and a separate volume source, such as a keyword tool or Search Console data for queries already reaching your site.