Search code examples
htmlweb-scraping

Modifying html before scraping a screenshot


When scraping a screenshot of a webpage, do any scraping tools have the capability to first edit the html content?

I would like to delete a particular line from the header, as below, then scrape a screenshot:

<style type="text/css"> .clps{display:none;} </style>


Solution

  • This question and answer posted to benefit other beginners. Thanks to AI for providing an answer, alas.

    Using shot-scraper to execute javascript to remove the line (following the -j flag), and then screenshot:

    shot-scraper -j 'document.querySelector("style[type=\"text/css\"]").remove()' https://www.link_to_a_webpage.com