Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rss-worker

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rss-worker

一个可配置的rss爬虫

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

rss-worker

Build Status Coverage Status

简介

rss-worker是一个持久的可配的rss爬虫。支持多URL的并行爬取,并且会将所有条目按时间顺序进行保存,保存格式为"时间\n标题\n内容\n\n",支持的保存方式有fs与mongodb。

使用

安装

直接通过npm:

npm install rss-worker --save

源码:

git clone git@github.com:DavidCai1993/rss-worker.git
cd rss-worker && npm i && gulp #编译coffee的输出目录为./build

例子

var RssWorker = require('rss-worker');

var opt = {
  urls: ['https://cnodejs.org/rss', 'https://github.com/DavidCai1993.atom', 'http://segmentfault.com/feeds'],
  store: {
    type: 'fs',
    dist: './store/rss.txt'
  }
};

var rssWorker = new RssWorker(opt);
rssWorker.start();

一个抓取https://github.com/alsotang.atomhttps://cnodejs.org/rsshttp://segmentfault.com/feeds/blogs内容24小时的输出(2015/5/6 19:30至2015/5/7 19:30 ,地址是随手挑的...←_←):这里

API

new RssWorker(options)

生成一个RssWorker的实例

options:

  • urls(Array) - 必选,需要抓取的rss地址的数组
  • store(Object) - 存储方式,需要配置typedist两属性
    • type - 存储方式,可选fs(默认)或mongodb
    • dist - 存储结果的文件地址(将会自动创建),如:./store/rss.txt(fs),mongodb://localhost:27017/rss_worker(mongodb)
  • timeout(Number) - 每次抓取的间隔(秒),默认为60秒
start()

开始抓取

forceToEnd()

发出停止抓取信号,将不会继续抓取,但不会影响到正在进行的本次抓取。

FAQs

Package last updated on 08 May 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc