Link resolution

Why some Google result links are redirects, how BestSERP replaces them with final URLs (resolveLinks, linksPending, unresolvedLinks) and how to poll them.

Updated View as Markdown

Google serves some result links as redirects (google.com/url?...). With resolveLinks (default true for /search and /news) the API replaces them with the final URL.

How it works

  1. Before answering, the API reads the destination of every redirect Google answers at once (milliseconds per link). Many responses have final URLs only.
  2. Google spaces out the rest of a fresh search's redirects, a few seconds each. Then the response says linksPending: true; those redirect links already work. Poll GET /requests/{requestId} (async requests) until linksPending is false, usually within 30 seconds, up to 2 minutes for searches with many redirects.
  3. unresolvedLinks counts links that are still redirects. With linksPending: false they stay that way.

Send "resolveLinks": false if you do not need final URLs: the response then never waits for them.

Fields affected: link of web results and news.