New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

scrape-scripts

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scrape-scripts

scrapes all <script> tags in an HTML document

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

scrape-scripts

experimental

Scrapes all <script> tags from a site's HTML. The callback is provided with a list of script objects with the data { type, src, body }, matching each <script> attribute.

src attributes are followed and the body replaced with the requested script's contents.

scrape('http://mattdesl.github.io/ink/index.html', function(err, results) {
  if (err) throw err
  
  // bundle.js
  console.log(results[0].src)  
  
  // contents of http://mattdesl.github.io/ink/bundle.js
  console.log(results[0].body)
})

Usage

NPM

scrape(uri|opt, callback)

Scrapes the uri String and triggers the callback after all script tags have been parsed and their src attributes followed.

Or, you can pass an opt object with the following:

  • uri - the URI string
  • loadSrc - boolean, whether to follow script src attribute and load the contents (default true)

License

MIT, see LICENSE.md for details.

Keywords

scrape

FAQs

Package last updated on 03 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts