项目作者: Rowno

项目描述 :
Perform bulk URL status checks and track changes.
高级语言: JavaScript
项目地址: git://github.com/Rowno/medic.git
创建时间: 2015-01-17T03:43:40Z
项目社区:https://github.com/Rowno/medic

开源协议:MIT License

下载


Medic

Build Status
Dependency Status

Perform bulk URL status checks and track changes.

Medic screenshot

Getting Started

Install the Medic command line tool:

  1. npm install -g medic

Create a urls.txt file:

  1. ---
  2. cookies:
  3. - Location=nz
  4. ---
  5. # Home pages
  6. https://rolandwarmerdam.co.nz/
  7. https://www.google.com/
  8. https://twitter.com/
  9. http://example.com/

Run medic:

  1. medic urls.txt

Also supports piping:

  1. cat urls.txt | medic

Usage

CLI

  1. Usage: medic <path> [<options>]
  2. Path:
  3. Path to a file containing a list of URLs. Each URL must be on a separate
  4. line and lines not starting with http:// or https:// are ignored.
  5. This parameter is ignored when URLs are being piped.
  6. File can also can also contain YAML front matter with the cookies option.
  7. Options:
  8. -c --concurrency Number of concurrent requests per origin. Defaults to 5.
  9. -h, --help Show this help text.
  10. -o, --output File path to output the results of this run to.
  11. -p, --compare Path to a previous results file to compare against.
  12. -v, --version Print medic's version.

API

.check(object options, [function callback]) -> Promise

Checks the status of all the passed URLs.

Options
cookies

Type: array

urls

Type: array

onProgress

Type: function<object result>

Gets called on each checked URL and is passed the result.

Example result:

  1. [
  2. {
  3. "url": "https://www.google.com/mail/",
  4. "statusCode": 200,
  5. "redirectUrl": "https://mail.google.com/mail/"
  6. }, {
  7. "url": "http://non-existent.example.com/",
  8. "error": "getaddrinfo ENOTFOUND"
  9. }
  10. ]

.compare(object options) -> array

Compares 2 result sets to find any changes.

Example return:

  1. [
  2. {
  3. "current": {
  4. "url": "https://reader.google.com/",
  5. "statusCode": 404
  6. },
  7. "previous": {
  8. "url": "https://reader.google.com/",
  9. "statusCode": 200
  10. }
  11. }
  12. ]
Options
currentResults

Type: array

previousResults

Type: array

License

Medic is released under the MIT license.

Copyright © 2015 Roland Warmerdam.