shorten-anonymize-url

1.6.1 • Public • Published

shorten-anonymize-url Beta npm dependencies devDependencies


Shorten and anonymize (derefer) URLs at the same time.
Supports Commandline and programmatic usage.
Uses goo.gl, bit.ly and dereferer.me under the hood.

Enables right-click URL shortening on macOS.
Includes the required Automator Service and installation toolset.

Available for macOS, Windows and Linux.


Contents

  1. Commandline Usage
  2. 'Right-Click' URL Shortener (macOS)
  3. Programmatic Usage
  4. Platform Support
  5. Roadmap
  6. Contribute
  7. Author

Commandline Usage

Installation

$ npm install --global shorten-anonymize-url

Usage

$ shorten-anonymize-url "<url>"

⚠️ Enclose URLs in quotes to handle special characters like as question marks ⚠️

Show Help and Options

$ shorten-anonymize-url --help

Example

$ shorten-anonymize-url "https://www.google.de/?gfe_rd=cr&ei=WDE4We-3BcfPXr7dpdgH&gws_rd=ssl"
>> http://bit.ly/2sglJKg

Right-Click URL Shortener (macOS only)

screenshot-macos

The module includes a global Service for macOS Automator, as well as an automated installation and uninstallation routine.

Features

The global shortener service does the following:

  1. It takes any marked url within macOS,
  2. shortens and anonymizes it,
  3. copies the resulting shortened and anonymized URL to the macOS clipboard.

This enables global url shortening and anonymizing.

Compatibility

The global nature of macOS Services makes this module available to nearly all macOS apps, such as Safari, Finder, Google Chrome or Microsoft Office for Mac.

Requirements for the macOS Service

Install the commandline module.

Install the macOS Service

Run the commandline module with the --service-install argument:

$ shorten-anonymize-url --service-install

Uninstall the macOS Service

Run the commandline module with the --service-uninstall argument:

$ shorten-anonymize-url --service-uninstall

Use the macOS Service

  1. Mark any URL (or any text),
  2. right-click,
  3. open the 'Services' menu,
  4. Click 'shorten-anonymize-url'

The clipboard now contains the shortened and anonymized URL.

Programmatic Usage

Installation

$ npm install --save shorten-anonymize-url

API

The module returns a Function which takes 3 arguments and returns a Promise:

const shortenAnonymizeUrl = require('shorten-anonymize-url')
shortenAnonymizeUrl(url, bitlyKey, googlKey)
.then((shorturl) => {
    console.log(shorturl);
})
  • url String - Bundle identifier for the callback function
  • bitlyKey [optional] String - bit.ly API key
  • googlKey [optional] String - goo.gl API key

The Promise resolves with:

  • shorturl String - Shortened anonymised bit.ly url

Example

const shortenAnonymizeUrl = require('shorten-anonymize-url')
shortenAnonymizeUrl('reddit.com')
.then((url) => {
    console.log(url);
    // http://bit.ly/2qWTDzM
})
.catch((err) => {
    console.error(err);
})

Platform Support

Tested on:

  • macOS Sierra
  • Windows 10 Anniversary
  • Ubuntu 17.10

Global 'Right-Click' url shortening only supported on macOS for now.

Roadmap img

  • Global Right-Click URL shortening for Windows + Linux
  • CI-based automated Testing

Contribute Contribute

Read the contribution documentation first.

  • Dev Chat: Talk about features and suggestions.
  • Issues File bugs and document issues.

Author

sidneys 2017

Package Sidebar

Install

npm i shorten-anonymize-url

Weekly Downloads

0

Version

1.6.1

License

MIT

Last publish

Collaborators

  • sidneys