0

I am scraping some sites to check if they are blocked so I compare different responses. I came to a conclusion that some have a specific function inside a script tag, and I don't know how to catch that. I tried several ways of parsing the response but couldn't do it... Thanks in advance!!

here's a piece of the script (it's in the body):

    <script> function ShowPopupRegistration(reason) {
        fancyAlert(...................);
    }
    $(document).ready(function () {
        $('#btn-join').click(function (e) {
           ...
        });
    }); </script>
nata1234
  • 1
  • 1

1 Answers1

0

You can get the whole HTML content of the page, which includes the <script> as well with page.content puppeteer method.

const content = await page.content()
if (content.includes('<script> function ShowPopupRegistration(')) {
  // do things
}
theDavidBarton
  • 7,643
  • 4
  • 24
  • 51