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

@igetter/core

v0.0.1

Published

<h1 align="center">IGetter</h1>

Downloads

3

Readme

IGetter是一个声明式、易扩展的监控型爬虫框架。

  • 声明式:IGetter是一个基础的监控型爬虫框架,用户只需编写相应的解析即可。其余的调度、下载、存储由IGetter负责。
  • 易扩展:IGetter使用Tapable暴露爬虫的生命周期,从发出请求到接收到响应整个过程都可控。
  • 监控型:IGetter更擅长以监控信息为目的的爬虫,例如:JavaScript周报更新、BiliBili UP 主视频更新...

IGetter主要分为Engine、Downloader、Job、Plugin、Store五部分。

Engine负责Job的添加、调度,传递Job的请求、Downloader的响应以及插件的注册。

Downloader是一个异步并发下载队列,负责下载Engine传递来的请求。使用superagent库来下载,如果想使用其他请求库,替换非常简单。

Job是使用者主要关注的地方,在这里主要进行爬虫的解析,存储。希望能利用开源的力量,将所有的Job聚集一起供用户使用,例如:知乎xxx新回答,xxx更新了微博,steamxxx游戏有更新...也是急需贡献的地方!

Plugin即为插件,IGetter将一个爬虫从发出请求到接收到响应整个过程使用Tapable暴露出来。可以在此做很多事情,例如:随机User-Agent、爬虫性能分析、模拟登录,爬虫监控、代理设置...

Store是IGetter提供的存储工具,使用nedb库,类mongoDB的语法更易使用。当然,如果想使用其他存储库,也可替换。

下面是一个简单的例子,目的是抓取https://example.com的title和content,并存储。 真实例子可以参考项目目录Example steamcn每日新闻。

class YourJob extends Job{
  public JobName = 'A Example Job' // 任务名称
  constructor(){
    super()
  }
  async run(){ // 任务主体
    let $ = this.$ // 内置解析器cheerio
    let pageFetch = await this.request({ // 发出请求,等待Downloader下载
      url: 'https://example.com'
    })
    let resBody = pageFetch.response.body // 获取响应
    return { // 返回的数据将会交由Engine存储值Store
      title: $('#title', resBody) // 使用cheerio获取title信息,
      content: $('#content', resBody) // 使用cheerio获取content信息
    }
  }
}