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
- Before answering, the API reads the destination of every redirect Google answers at once (milliseconds per link). Many responses have final URLs only.
- 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. PollGET /requests/{requestId}(async requests) untillinksPendingisfalse, usually within 30 seconds, up to 2 minutes for searches with many redirects. unresolvedLinkscounts links that are still redirects. WithlinksPending: falsethey 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.