slector
v2.4.1
Published
This can be used to select html & css targets and save as a config for use in crawling projects. This is not a crawler.
Downloads
5
Readme
Slector
Preparing Queries for Web-Scraping
This package is used to create 'Slectors' (otherwise known as DOM Queries) which you can then use in your Web Scraping | Machine Learning projects.
Quickstart Guide
Initialise a Node Project.
Install Slector:
npm install slector -D
Import Slector:
import Slector from "slector";
Create a Slector options object:
const options = {showExtConsole: true, collectionTypes: ["EndPoint", "Method Description"], startUrl: "https://www.coingecko.com/en/api/documentation", slectors: previousSlectors, exportTextContent: true,}
Slector Options Available
| Property | Definition | Required? | | ----------------- | --------------------------------------------------------------------- | --------- | | collectionTypes | string[]: The available Slector names/categories/groups. | ✅ | | startUrl | string: The first url to navigate to (after extension setup) | ✅ | | slectors | slectors[]: Previously exported slector data to load on setup. | ❌ | | exportTextContent | boolean: Will collect text content of all highlighted DOM elements. | ❌ | | showExtConsole | boolean: Will open background-script inspector on startup. | ❌ |
Create a new Slector Instance:
const slector = new Slector(options);
Run Slector and export data:
const res = await slector.slect();
Open the browser, make your selections, and when you click 'DONE' in the extension - return all your Slector Instance JSON data.