🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

redis-web-crawler

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-web-crawler

Web Crawler to create directed graph of links among connected sites. Runs with Node.js and stores data with Redis

1.0.0
latest
Source
npm
Version published
Maintainers
1
Created
Source

Web Crawler with Redis Graph

version downloads

Read the blog post.

Web Crawler built with NodeJS. Fetch site data from a given URL and recursively follow links across the web.

Search the sites with either breadth first search, or depth first search.

Every URL will be saved to a Graph (using an adjacency list). The Graph is stored with Redis.

Installation

npm install --save redis-web-crawler

Usage

Run a local redis server to store output: $ redis-server

Create a new crawler instance and pass in a configuration object. Call the run method to begin crawling.

  import WebCrawler from 'redis-web-crawler';

  const crawlerSettings = {
    startUrl: 'https://en.wikipedia.org/wiki/Main_Page',
    followInternalLinks: false,
    searchDepthLimit: null,
    searchAlgorithm: "breadthFirstSearch",
  }

  var crawler = new WebCrawler(crawlerSettings);
  crawler.run();

Configuration Properties

NameTypeDescription
startUrlstringA valid URL off a page with links.
followInternalLinksbooleanToggle searching through internal site links
searchDepthLimitintegerSet a limit on the recursive URL requests
searchAlgorithmstring"breadthFirstSearch" or "depthFirstSearch"

Exporting the Redis Graph

  • clone the Redis Dump Repo
  • run commands to install gem dependencies (refer to redis-dump/README)
  • with redis server up and running:
    • note the slave and port of the redis-server (e.g. 6371)
    • in project root folder, run ./bin/redis-dump -u 127.0.0.1:6371 > db_full.json
    • view the Redis export in db_full.json

spencerlepine.com  ·  GitHub @spencerlepine  ·  Twitter @spencerlepine

Keywords

node

FAQs

Package last updated on 15 Aug 2021

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