1.0.1 • Published 7 years ago

get-href-urls v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

get-href-urls

CircleCI

NPM

A utility tool for find all urls in an html page, that are inside an anchor tag.

Example matches:

MyWebPage.html

<a href="https://theverge.com">theverge.com</a>

To find links:

const getHrefUrls = require("get-href-urls");
const fs = require("fs");

fs.readFile("./MyWebPage.html", "utf8", function (err,data) {
	if (err) {
		return console.log(err);
	}
	const urls = getHrefUrls(data);
	// output: ["https://theverge.com"]
});

Using in the command line:

curl "https://www.theverge.com" | get-href-urls
// output: ["https://theverge.com"]