Détail du package

html-link-extractor

tcort253.2kMIT1.0.5

extracts links from html text

html, link, extractor, href

readme

html-link-extractor

Extracts links from html texts.

Installation

$ npm install --save html-link-extractor

API

htmlLinkExtractor(html)

Parameters:

  • html text in html format.

Returns:

  • an array of URLs

    Examples

const { readFileSync } = require('fs');
const htmlLinkExtractor = require('html-link-extractor');

const html = readFileSync('index.html', {encoding: 'utf8'});

const links = htmlLinkExtractor(html);
links.forEach(link => console.log(link));

Testing

npm test

License

See LICENSE.md

changelog

Changes

Version 1.0.5

  • fix additional github links in package.json

Version 1.0.4

  • fix github link in package.json

Version 1.0.3

  • Add missing cheerio dependency

Version 1.0.2

  • Fix issue where <a> tags without the href attribute were extracted as undefined

Version 1.0.1

  • Fix extraction of <img/> and other links

Version 1.0.0

  • Initial Release