<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: SerpBase</title>
    <description>The latest articles on DEV Community by SerpBase (serpbase-dev).</description>
    <link>https://dev.to/serpbase-dev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F16719%2F5e0e3d97-e958-46bb-9a9b-36ece2ee3fab.png</url>
      <title>DEV Community: SerpBase</title>
      <link>https://dev.to/serpbase-dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/serpbase-dev"/>
    <language>en</language>
    <item>
      <title>When the url field is the redirect, not the page</title>
      <dc:creator>Petix Pleasure</dc:creator>
      <pubDate>Fri, 04 Dec 2026 02:50:24 +0000</pubDate>
      <link>https://dev.to/serpbase-dev/when-the-url-field-is-the-redirect-not-the-page-fa4</link>
      <guid>https://dev.to/serpbase-dev/when-the-url-field-is-the-redirect-not-the-page-fa4</guid>
      <description>&lt;p&gt;If you pipe a search result's &lt;code&gt;url&lt;/code&gt; into &lt;code&gt;fetch()&lt;/code&gt; and let it follow redirects, 24 of the 29 rows I pulled this morning reach &lt;code&gt;google.com&lt;/code&gt; before anything else. I did not pick the wrong field out of carelessness. The response offers five fields that look like a link, and in my data none of them is the page address on its own.&lt;/p&gt;

&lt;p&gt;I collected three &lt;code&gt;POST /google/search&lt;/code&gt; responses: two pages for the query &lt;code&gt;"undici fetch timeout AbortSignal"&lt;/code&gt; (&lt;code&gt;page:1&lt;/code&gt;, &lt;code&gt;page:2&lt;/code&gt;) and one &lt;code&gt;page:1&lt;/code&gt; for &lt;code&gt;"postgres jsonb index not used"&lt;/code&gt;. Together they hold 29 organic rows, 10, 10 and 9. Five fields per row look addressable: &lt;code&gt;link&lt;/code&gt;, &lt;code&gt;url&lt;/code&gt;, &lt;code&gt;source_url&lt;/code&gt;, &lt;code&gt;display_url&lt;/code&gt;, &lt;code&gt;display_link&lt;/code&gt;. Across those 29 rows, &lt;code&gt;url&lt;/code&gt; and &lt;code&gt;link&lt;/code&gt; were byte-for-byte identical 29 times out of 29. The official field table says &lt;code&gt;url&lt;/code&gt; carries the normalized result link and is usually the same as &lt;code&gt;link&lt;/code&gt;. In my three responses it was the same every single time, which makes &lt;code&gt;url&lt;/code&gt; a copy and not a repair.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Disclosure: this post was drafted with an AI assistant and checked line by line against real API responses. Every number below was re-read from the saved JSON.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Check one: 24 of the 29 links start on google.com
&lt;/h2&gt;

&lt;p&gt;Counting &lt;code&gt;organic[].link&lt;/code&gt; per response, 7 of 10 on the first one, 9 of 10 on the second, 8 of 9 on the third begin with the &lt;code&gt;www.google.com/goto?url=&lt;/code&gt; prefix. That is 24 wrappers out of 29 rows. The remaining five are real addresses: two on &lt;code&gt;github.com&lt;/code&gt;, one on &lt;code&gt;stackoverflow.com&lt;/code&gt;, one on &lt;code&gt;community.fly.io&lt;/code&gt;, one on &lt;code&gt;michael.otacoo.com&lt;/code&gt;. So the host distribution of the raw &lt;code&gt;link&lt;/code&gt; field looks like five sites plus a redirector that outweighs all of them combined.&lt;/p&gt;

&lt;p&gt;If your pipeline inserts &lt;code&gt;link&lt;/code&gt; into a table and calls it done, 82 percent of the rows in my sample store a Google redirect with a long opaque token, not a page. Those tokens are also long enough to bloat a dedupe key: the &lt;code&gt;url=&lt;/code&gt; parameter runs from 139 to 255 characters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check two: url equals link, 29 out of 29
&lt;/h2&gt;

&lt;p&gt;I ran a strict equality test on &lt;code&gt;organic[].url === organic[].link&lt;/code&gt;, with no normalization on either side. It passed for all 29 rows. The first two responses were fully wrapped at 10 of 10 for this comparison, the third at 9 of 9.&lt;/p&gt;

&lt;p&gt;This is the part that changes how I read the field table. &lt;code&gt;url&lt;/code&gt; sounds like the place where a parser would put the resolved target and &lt;code&gt;link&lt;/code&gt; the raw one. My responses do not show that split at all: the two fields are the same string, so &lt;code&gt;url&lt;/code&gt; inherits every wrapper &lt;code&gt;link&lt;/code&gt; has. Anyone who switches from &lt;code&gt;link&lt;/code&gt; to &lt;code&gt;url&lt;/code&gt; to escape the redirects gets the same redirects, now with a false sense of having normalized something.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check three: display_url fails new URL() 29 out of 29
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;display_url&lt;/code&gt; is the field people reach for when they want a readable host. Passing all 29 values to &lt;code&gt;new URL()&lt;/code&gt; threw on every one. The three shapes behind that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;23 rows carry the U+203A pointer character as a path separator, for example a &lt;code&gt;github.com&lt;/code&gt; issue URL broken into &lt;code&gt;nodejs&lt;/code&gt;, &lt;code&gt;undici&lt;/code&gt; and &lt;code&gt;issues&lt;/code&gt; segments.&lt;/li&gt;
&lt;li&gt;8 rows end in &lt;code&gt;...&lt;/code&gt;, truncated mid-path, for example a &lt;code&gt;rinblog.org&lt;/code&gt; path cut after &lt;code&gt;javascript-fetc&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;6 rows do not start with &lt;code&gt;http&lt;/code&gt; at all, for example &lt;code&gt;medium.com&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those three groups overlap, which is why they sum past 29. The field is a display string assembled for eyes on a screen. It is not a URL and was never meant to survive a parse.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;display_link&lt;/code&gt; is the Google presentation text, and I did not build any branch on it.&lt;/p&gt;

&lt;h2&gt;
  
  
  source_url decodes to bytes, not to addresses
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;source_url&lt;/code&gt; is present on all 29 rows. Taking the &lt;code&gt;url=&lt;/code&gt; parameter as base64url, all 29 decode to bytes, so the encoding is honest. What comes out is not an address: 0 of the 29 decoded buffers contain the substring &lt;code&gt;http&lt;/code&gt;. The first token is 143 characters and yields 107 bytes, 0.36 of them printable, starting with &lt;code&gt;0801126701c42245d7c518a1220005a4&lt;/code&gt;. That looks like a serialized redirect record.&lt;/p&gt;

&lt;p&gt;The practical reading: decoding the token offline is not a shortcut to the destination. Reaching the page requires a network hop, so either you follow redirects yourself or you hand the links to something that does.&lt;/p&gt;

&lt;h2&gt;
  
  
  The field table I wish the docs had
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;field&lt;/th&gt;
&lt;th&gt;type&lt;/th&gt;
&lt;th&gt;what I measured in these responses&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;link&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;string&lt;/td&gt;
&lt;td&gt;24 of 29 are &lt;code&gt;www.google.com/goto?url=&lt;/code&gt; wrappers, 5 are direct&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;url&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;string&lt;/td&gt;
&lt;td&gt;identical to &lt;code&gt;link&lt;/code&gt; on 29 of 29 rows&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;source_url&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;string&lt;/td&gt;
&lt;td&gt;present on 29 of 29, decodes to bytes, 0 contain &lt;code&gt;http&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;display_url&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;string&lt;/td&gt;
&lt;td&gt;unparsable on 29 of 29, 23 use U+203A, 8 end in &lt;code&gt;...&lt;/code&gt;, 6 lack a scheme&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;display_link&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;string&lt;/td&gt;
&lt;td&gt;presentation text, not treated as a link by my script&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;position&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;number&lt;/td&gt;
&lt;td&gt;the block index on the page, shared by every row in that block&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;rank&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;number&lt;/td&gt;
&lt;td&gt;1-based index inside the block, the one to sort by&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;position&lt;/code&gt; and &lt;code&gt;rank&lt;/code&gt; split matters for the same reason the link fields do. In my third response &lt;code&gt;position&lt;/code&gt; read 1, 2, 4, 5, 6, 7, 8, 9, 10 while &lt;code&gt;rank&lt;/code&gt; read 1 through 9. If you sort on &lt;code&gt;position&lt;/code&gt; you get block order with a gap; &lt;code&gt;rank&lt;/code&gt; is the field that gives you the order the rows appear in. I did not find an explanation for the gap, so I am only reporting that it showed up there.&lt;/p&gt;

&lt;h2&gt;
  
  
  The twenty-line check I run before trusting any field
&lt;/h2&gt;

&lt;p&gt;This needs one saved response file and no credentials. Point it at a &lt;code&gt;/google/search&lt;/code&gt; body you already have.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'./resp.json'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;org&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;organic&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;stats&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;urlEqualsLink&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;link&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;wrapped&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;link&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;host&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'www.google.com'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;displayUrlUnparsable&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;display_url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;missingDate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;published_at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stats&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;follow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hops&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;redirect&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'manual'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;AbortSignal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;timeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;15000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;loc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'location'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;loc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;hops&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;final&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;follow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;loc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;href&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hops&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Against my first response it printed &lt;code&gt;total: 10&lt;/code&gt;, &lt;code&gt;urlEqualsLink: 10&lt;/code&gt;, &lt;code&gt;wrapped: 7&lt;/code&gt;, &lt;code&gt;displayUrlUnparsable: 10&lt;/code&gt;, &lt;code&gt;missingDate: 2&lt;/code&gt;. Running &lt;code&gt;follow()&lt;/code&gt; on the first wrapped link returned &lt;code&gt;hops: 3&lt;/code&gt;, &lt;code&gt;status: 200&lt;/code&gt; and the destination &lt;code&gt;rinblog.org/javascript-fetch-api-update/&lt;/code&gt; at 70,733 bytes. The three hops were &lt;code&gt;www.google.com/goto&lt;/code&gt;, then &lt;code&gt;www.google.com.hk/url&lt;/code&gt; with &lt;code&gt;pref=hkredirect&lt;/code&gt;, then &lt;code&gt;www.google.com.hk/goto&lt;/code&gt;. The redirect crosses from the &lt;code&gt;.com&lt;/code&gt; host to the &lt;code&gt;.com.hk&lt;/code&gt; host, which is why a client capped at two redirects gives up on a link that works fine in a browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Following by hand, or handing the links over
&lt;/h2&gt;

&lt;p&gt;Two options, and the choice depends on how many links you have and how much you want to depend on one extra call.&lt;/p&gt;

&lt;p&gt;Doing it by hand with &lt;code&gt;redirect: 'manual'&lt;/code&gt; costs one function and no extra service. It is the right call for a handful of links, for debugging, and for any pipeline that already has timeout and retry logic around &lt;code&gt;fetch()&lt;/code&gt;. Set the redirect budget to at least three, or you will log a failure that is really a budget of two.&lt;/p&gt;

&lt;p&gt;The batched option earns its place once you have a page of results. Sending those 24 wrapper links as one &lt;code&gt;POST /google/resolve&lt;/code&gt; call with a &lt;code&gt;links&lt;/code&gt; array returned 24 entries, every one of them marked &lt;code&gt;resolved&lt;/code&gt;. The 24 resolved URLs collapse to 22 distinct ones. Add the 5 direct links and the 29 rows become 27 distinct pages across 16 hosts, against 5 hosts if you count the raw &lt;code&gt;link&lt;/code&gt; field. The wrappers were hiding duplicates: two different links of 194 and 195 characters resolve to the same &lt;code&gt;qiita.com&lt;/code&gt; page, and two more of 284 and 286 characters resolve to the same &lt;code&gt;medium.com&lt;/code&gt; page. I could not see that from the raw field at all.&lt;/p&gt;

&lt;p&gt;I still count the hops myself when something breaks, because the resolver tells me where a link went, not why a fetch failed.&lt;/p&gt;

&lt;p&gt;The JSON I measured came from calls to a SERP endpoint; the same shapes appear in any response that carries these fields. serpbase.dev is where mine came from, and the numbers above are the fields I read back from those saved responses.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this changes in a pipeline
&lt;/h2&gt;

&lt;p&gt;For a crawler that feeds articles into storage, the useful order is: check whether the field exists, check whether the sibling keys you depend on are populated, then resolve before insert. Sorting and dedupe belong on the resolved URL, and the redirect field is worth keeping as provenance rather than as a key. Every number here comes from three responses to two queries on one morning, so treat it as a shape to test for, not a constant.&lt;/p&gt;

</description>
      <category>abotwrotethis</category>
      <category>api</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
