Skip to content

πŸ“ A simple (SEO) ping tool that follows HTTP redirections

Notifications You must be signed in to change notification settings

mawrkus/ping-bong

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

66 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Ping Bong

npm npm Node version

A simple SEO ping tool that follows HTTP redirections.

πŸ“ Installation

npm install -g ping-bong

Or using it directly with npx:

npx ping-bong http://gizmodo.com

πŸ“ Usage

CLI

npx ping-bong http://gizmodo.com
[
  {
    "method": "head",
    "url": "http://gizmodo.com",
    "to": "https://gizmodo.com/",
    "statusCode": 301,
    "statusText": "Moved Permanently",
    "responseTime": 71,
    "userAgent": "ping-bong/3.0.8"
  },
  {
    "method": "head",
    "url": "https://gizmodo.com/",
    "to": "https://es.gizmodo.com/",
    "statusCode": 302,
    "statusText": "https://es.gizmodo.com/",
    "responseTime": 68,
    "userAgent": "ping-bong/3.0.8"
  },
  {
    "method": "head",
    "url": "https://es.gizmodo.com/",
    "statusCode": 200,
    "statusText": "OK",
    "responseTime": 82,
    "userAgent": "ping-bong/3.0.8"
  }
]

API

const PingBong = require('ping-bong');

(async () => {
  const pingyBong = new PingBong({
    httpOptions: {
      method: 'get',
      headers: {
        'User-Agent': 'pingee-beengee/42.0',
      },
      maxRedirects: 10,
    },
    includes: {
      'request.method': 'method',
      'request.url': 'url',
      'response.headers.location': 'to',
      'response.status': 'statusCode',
      'response.statusText': 'statusText',
      'response.responseTime': 'responseTime',
      'request.headers.user-agent': 'userAgent',
    },
  });

  const redirections = await pingyBong.check({
    url: 'http://gizmodo.com',
  });

  console.log(JSON.stringify(redirections, null, 2));
})();

πŸ“ Demo

$ git clone https://github.com/mawrkus/ping-bong.git
$ cd ping-bong
$ npm install
$ npm run demo

About

πŸ“ A simple (SEO) ping tool that follows HTTP redirections

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published