0

Is there library or framework within Node I can use to check if a webpage has a script loaded on it - i.e a Javascript library

Like when you open dev tools in chrome on a webpage and do ctrl shift f and search for scripts or code.

Or is there a way I can access this information in dev tools using a framework in Node?

Edit: Not necessarily scripts loaded on the page but within the whole set of site files. Like you can do with dev console ctrl shift f

Thanks

Sam
  • 1,207
  • 4
  • 26
  • 50
  • you can get the source code of a web page and check for script tags and lineked scripts. – Madhawa Priyashantha Mar 04 '19 at 14:03
  • @MadhawaPriyashantha yes but this doesn't show all the included. For instance if I search for something within the source code it doesn't find the file, but searching through dev console it does – Sam Mar 04 '19 at 14:24
  • 1
    those are the script loaded by ajax request.you can get them too.check this out https://stackoverflow.com/questions/28739098/how-can-i-scrape-pages-with-dynamic-content-using-node-js – Madhawa Priyashantha Mar 04 '19 at 14:29
  • Thanks @MadhawaPriyashantha is there any other way other than a crawler to use something like wget to check if a name of a file exists on an entire website? – Sam Mar 04 '19 at 14:49
  • there is another way not sure whether it will work or not.you can inject script to a website.for node you can do that using libraries like puppeteer or phantom .you have to inject a function to detect new http request.here is detailed question.https://stackoverflow.com/questions/20621084/how-to-get-list-of-network-requests-done-by-html then you can get all the urls – Madhawa Priyashantha Mar 04 '19 at 14:55
  • It is possible to execute the same search in sources via [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) using [puppeteer](https://github.com/GoogleChrome/puppeteer). If you can provide a page URL and a string to search, I can try to answer with an example. – vsemozhebuty Mar 04 '19 at 17:50

0 Answers0