# scrape-scripts

> scrapes all tags in an HTML document

Latest version **1.1.0** (published 2016-04-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install scrape-scripts
pnpm add scrape-scripts
yarn add scrape-scripts
bun add scrape-scripts
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2016-04-03 |
| First published | 2015-04-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Matt DesLauriers |
| Maintainers | mattdesl |
| Keywords | scrape, script, tags, bundle, java, script, js, src, scripts, html, parse |

## Links

- npm: https://www.npmjs.com/package/scrape-scripts
- Repository: https://github.com/mattdesl/scrape-scripts
- Issues: https://github.com/mattdesl/scrape-scripts/issues
- npm.io page: https://npm.io/package/scrape-scripts

## Dependencies (4)

- [cheerio](https://npm.io/package/cheerio.md) ^0.19.0
- [request](https://npm.io/package/request.md) ^2.55.0
- [map-limit](https://npm.io/package/map-limit.md) 0.0.1
- [object-assign](https://npm.io/package/object-assign.md) ^2.0.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.1.0 (latest) — 2016-04-03
- 1.0.5 — 2016-02-08
- 1.0.4 — 2016-02-08
- 1.0.3 — 2015-04-27
- 1.0.2 — 2015-04-26
- 1.0.1 — 2015-04-26
- 1.0.0 — 2015-04-26

## README

# scrape-scripts

[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)

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.

```js
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](https://nodei.co/npm/scrape-scripts.png)](https://www.npmjs.com/package/scrape-scripts)

#### `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](http://github.com/mattdesl/scrape-scripts/blob/master/LICENSE.md) for details.

---
_Source: https://npm.io/package/scrape-scripts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
