How AI is applied across API Evangelist and APIs.io. Read my AI disclosure →
API Evangelist API Evangelist
Discovery
Learnings
Guidance
Toolbox
Alignment
API Evangelist LLC

How to remove any element from the HTML response

calendar_today December 31, 0000 person domain scrapingbee

Sometimes you may need to remove specific HTML elements from the page's content, either to get cleaner results for your data extraction rules, or to simply delete unnecessary content from your response.

To achieve that using ScrapingBee, you can use aJavaScript Scenario, with an evaluate instruction and execute this custom JS code:

document.querySelectorAll("ELEMENT-CSS-SELECTOR").forEach(function(e){e.remove();});​

For example, to remove all of the <style> elements from the response, you can use this JavaScript Scenario:

open_in_new Read original post