npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sitequery

v0.2.8

Published

A reactive framework for asynchronous web crawling.

Downloads

30

Readme

       _                     
      (_)   _                                             
  ___  _  _| |_  _____   ____  _   _  _____   ____  _   _ 
 /___)| |(_   _)| ___ | / _  || | | || ___ | / ___)| | | |
|___ || |  | |_ | ____|| |_| || |_| || ____|| |    | |_| |
(___/ |_|   \__)|_____) \__  ||____/ |_____)|_|     \__  |
                           |_|                     (____/ 
                                                                                      

A reactive framework for asynchronous web crawling.

Overview

sitequery is a reactive webcrawling framework that enables web crawling through server-side execution of jQuery selectors. sitequery uses rx.js to model crawls as async sequence of pages that map to a async sequence of jQuery selected page elements.

Installation

Prerequisites

sitequery requires a redis installation see: http://redis.io/download

npm install

[sudo] npm install sitequery

Features

sitequery has two main abstractions SiteCrawl and SiteQuery which provide the following features:

  • Web crawls can be paramerized to only go n levels deep
  • Configurable crawl timeout
  • Web crawls use a redis store to track visitation and insure a web crawl is cycle-free (no web page is crawled more than once for a given SiteCrawl instance)
  • Any valid jQuery selector can be executed across an entire website (web crawl sequence)
  • Support for the latest jQuery version

Usage

Crawling a website using SiteCrawl observable

(From: /examples/hello-crawl.js)

Allows you to crawl to a depth of n into a website

var SiteCrawl = require('../lib/sitecrawl').SiteCrawl;

// create a new SiteCrawl of depth 2 with a delay of 1s between next page and will only run for 10s
// Note: Webcrawling is delayed and will not be executed
// until Subscription
var siteCrawl = new SiteCrawl({url:'http://loku.com',  maxDepth:2, delay:1000, maxCrawlTime:10000});

// ask for the observable sequence and subscribe for the CrawlResult(s)
siteCrawl.toObservable().Subscribe(function(crawlResult) {                 
  console.log(crawlResult.crawlLink.url.href);
},
// on err
function(exn){
  console.log('Ooo dem Dukes...with exception:' + exn);
},
// on crawl complete
function(){
  console.log('SiteCrawl complete');
});

Executing a jQuery selector on a site using SiteQuery observable

(From: /examples/hello-query.js)

Execute jQuery selector to a depth of n on a website

var SiteQuery = require('../lib/sitequery').SiteQuery;

// create a new SiteQuery of depth 2 with a delay of 1s between next page crawl
// selecting for `img` elements on each page
// Note: Webcrawling is delayed and will not be executed
// until Subscription
var siteQuery = new SiteQuery({url:'http://loku.com', maxDepth:2, delay:1000}, 'img');

// ask for the observable sequence and subscribe for selected jQuery element(s)
siteQuery.toObservable().Subscribe(function(result.elem) {
// output the img src                 
  console.log(result.elem.attr('src'));
},
// on err
function(exn) {
  console.log('Something blowd up with exception:' + exn);
},
// on crawl complete
function() {
  console.log('SiteQuery complete');
});

Credits

ToDo

  • ~~Make practical~~ - Big performance improvements with version post 0.1.3
  • ~~Obey robots.txt~~
  • Performance profiling
  • Experiment with jquip
  • Add post-processing backends
  • Graceful errors/degradation for incomplete data/dom for SiteCrawl
  • Handling parse errors more gracefully
  • Simulate auth into the target site when necessary
  • Parallelisation of requests through rx.js ForkJoin
  • Add asynchronous parsing
  • Distribute high-cost computation
  • Make crawl selection plugable
  • Add code to term drain node.js Event queue to insure process termination

License

Copyright (c) Loku. All rights reserved. The use and
distribution terms for this software are covered by the Eclipse
Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
which can be found in the file epl-v10.html at the root of this
distribution. By using this software in any fashion, you are
agreeing to be bound by the terms of this license. You must
not remove this notice, or any other, from this software.