Appearance
JavaScript Rendering
All these features are working with the js_render
parameter set to true
.
Block Resources
Blocking resources means preventing your headless browser from downloading specific types of content that you don’t need for your scraping task. This can include images, stylesheets, fonts, and other elements that might not be essential for your data extraction.
We automatically blocks certain resource types by default, such as stylesheets and images, to optimize scraping speed and reduce unnecessary data load. So we recommend not using this feature unless it’s really necessary. If you prefer to disable resource blocking entirely, set the parameter to
block_resources=none
Available Resource Types
BitFetcher allows you to block the following resource types:
Resource Type | Description |
---|---|
stylesheet | CSS files for page styling. |
image | Images, icons, and banners. |
media | Audio and video files. |
font | Web fonts for text styling. |
script | JavaScript files. |
xhr | AJAX requests via XMLHttpRequest. |
fetch | Fetch API requests. |
eventsource | Server-sent events requests. |
websocket | WebSocket connections. |
manifest | Web app metadata files. |
other | Miscellaneous resource types. |
To block multiple resources, separate them with commas. For example, to block images and stylesheets, use block_resources=image,stylesheet
.
Screenshots
If you want to get a screenshot of the page you want to scrape, use the screenshot=true
parameter. By default, the image will be in PNG format.
Optional Parameters
screenshot_fullpage=true
takes a full-page screenshot.screenshot_selector=<CSS Selector>
takes a screenshot of the element given in the CSS Selector.
These screenshot features can be combined with other options like wait
, wait_for
, or js_scenario
to ensure that the page or elements are fully loaded before capturing the image. When using json_response
, the result will include a JSON object Screenshot with the screenshot data encoded in base64, allowing for easy integration into your workflows.
When using
screenshot=true
, block_resources
will automatically be set to False so the browser will load images and CSS before taking the screenshot. When using
screenshot=true
with js_scenario
, the screenshot will be captured only after all JavaScript instructions have completed execution. Screenshot Formats
In addition to the basic screenshot functionality, offers customization options to optimize the output. These features are particularly useful for reducing file size, especially when taking full-page screenshots where the image might exceed 10MB, causing errors.
screenshot_format
: Choose betweenpng
andjpeg
formats, with PNG being the default. PNG is great for high-quality images and transparency, while JPEG offers efficient compression.screenshot_quality
: Applicable when using JPEG, this parameter allows you to set the quality from1
to100
. Useful for balancing image clarity and file size, especially in scenarios where storage or bandwidth is limited.