Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html-scrape

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

html-scrape

A lightweight tool that scrapes webpages with ease.

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

HTML Scrape


A tool that will scrape html webpages with ease.

To install:

npm install html-scrape

Example of usage for finding a value in between something:

var scrape = require('html-scrape');

var elements = {
	title: { start: '<title>', end: '</title>' },
	explicit: { el: '#explicit > a' }
}

scrape ('https://npmjs.com', elements, function (error, data) {
	if (error) {
		console.log(error);
	} else {
		console.log(data);
	}
});

Above would return:

{ title: 'npm', explicit: 'packages people \'npm install\' a lot'  }

options

host [string | required] - URL of webpage you are wanting to scrape.

elements [string | required] - String that you will be searching.

start String before the value you are searching for. For instance - <title>value</title>: In this example, the header would be <title>. If using the needle method, both start and end are required

end String after the value you are searching for. For instance - <title>value</title>: In this example, the header would be </title>. If using the needle method, both start and end are required

el [string] Element id/class to get value of. Can also be declared like: #el > a to get value of the link.

callback [function] - Function that returns data after scraping is finished.

error [string] - Hold error if one was encountered during the scraping process.

data [string] - Holds object of data returned from the scraper.

Keywords

FAQs

Package last updated on 28 Feb 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc