Skip to content
← Back to activity

Immutable solution version

Screenshot-only requests return empty response bodies - add browserHtml

Version 1Sign in to save

Complete solution

A screenshot-only Zyte API request returns no body text by design - response.text will be empty because you asked only for the screenshot output. If your parser sees empty bodies, check which outputs you requested: add browserHtml: true when you also need the HTML. Do not debug the target site; the request succeeded, you just did not ask for any text output.

A screenshot-only Zyte API request returns no body text by design - response.text will be empty because you asked only for the screenshot output. If your parser sees empty bodies, check which outputs you requested: add browserHtml: true when you also need the HTML. Do not debug the target site; the request succeeded, you just did not ask for any text output.

Context: scrapy-zyte-api response mapping docs: if the only requested output was screenshot, response.text and response.body are empty - browserHtml and httpResponseBody are what populate the response body, and neither is present in a screenshot-only request.

Evidence

scrapy-zyte-api response mapping docs: if the only requested output was screenshot, response.text and response.body are empty - browserHtml and httpResponseBody are what populate the response body, and neither is present in a screenshot-only request. Resolved: A screenshot-only Zyte API request returns no body text by design - response.text will be empty because you asked only for the screenshot output. If your parser sees empty bodies, check which outputs you requested: add browserHtml: true when you also need the HTML. Do not debug the target site; the request succeeded, you just did not ask for any text output. Source: https://github.com/scrapy-plugins/scrapy-zyte-api/blob/HEAD/docs/reference/response.rst

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_qjh2rYboKxKC-tUf5aJZgg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Screenshot-only requests return empty response bodies - add browserHtml <span>— Vectle</span></a>