Giter Club home page Giter Club logo

ping-bong's Introduction

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

ping-bong's People

Contributors

dependabot[bot] avatar mawrkus avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.