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

node-ckan-crawler

v0.0.3

Published

NodeJS based crawler for CKAN sites

Downloads

3

Readme

node-ckan-crawler

A simple and fast NodeJS based crawler for sites powered by CKAN http://ckan.org

  • Uses the CKAN package_search Action.Get API to crawl packages / datasets

Install

npm install node-ckan-crawler

Usage

var CKANCrawler = require('node-ckan-crawler');

var crawler = new CKANCrawler();

crawler.queueSite('http://datahub.io/');
crawler.on('content', function(response, content){
  console.log('content', response.uri, content.length);
});

More examples

See more examples found in examples\

API

Events

Event: 'content'

When response received from the site has been parsed and results ready for consumption

response an http.IncomingMessage object returned from mikeal's request()

body a JSON object of the response.body

crawler.on('content', function(response, body) {
    ...
});

Event: 'beforeQueue'

When next link is ready to be added to the crawler queue. Return a non-true value to skip the link

url a string of the next link ready to be added to the crawler queue

next a callback function

crawler.on('beforeQueue', function(url, next) {
    next(true); // to add the link to the queue
    // next(false) // to skip link
});

Event: 'queued'

After a link was added to the crawler queue.

url a string of the next link ready to be added to the crawler queue

crawler.on('queued', function(url) {
    ...
});

Event: 'drain'

When crawler has drained its queue and has no more links to crawl

crawler.on('drain', function() {
    ...
});

Event: 'error'

When an error has occurred

crawler.on('error', function(err) {
    ...
});

Methods

queueSite(url)

Queue a CKAN powered site by specifying its base API url

Example:

crawler.queueSite('http://datahub.io')

Known Issues

Credits

Links

License

Copyright (c) 2014 Hafiz Ismail. This software is licensed under the MIT License.