GithubHelp home page GithubHelp logo

stu01509 / pretty-link Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 228 KB

πŸ”— A powerful Node.js short URL library, currently supporting Bitly, TinyURL, PicSee, reurl, 0rz.tw

Home Page: https://www.npmjs.com/package/prettylink

License: MIT License

JavaScript 100.00%
bitly tinyurl reurl picsee 0rz shorten url-shortener link-shortener url-short link-short link url hacktoberfest2020 hacktoberfest

pretty-link's Introduction

πŸ”—Pretty-Link : A powerful Node.js short URL library

npm npm Node version License: MIT Test Status PRs Welcome

Installation

In order to use Pretty-Link, make sure that you have Node version 8.0.0 or higher.

npm install prettylink

Or Yarn.

yarn add prettylink

Usage

Pretty-Link this module provides five URL shorten service, such as Bitly, TinyURL, PicSee, reurl and Pixnet0rz.tw, to calls to their API for Node.js

For more information on the Token applicant or API request and responses please checkout API Info or visit their official guide.

const prettylink = require('prettylink');

// Init Access Token in constructor 
const bitly = new prettylink.Bitly('BitlyAccessToken');
// Or use init function
bitly.init('BitlyAccessToken');
bitly.short('https://github.com/stu01509/pretty-link').then((result) => {
  console.log(result);
}).catch((err) => {
  console.log(err);
});

See examples folder for more detail examples.

API Info

Bitly

Bitly Official API docs Bitly Access Token generate

  • bitly.init(AccessToken) - Initialize AccessToken.
  • bitly.short(longUrl) - Convert a long url to short url.
  • bitly.expand(bitlinkId) - Convert a bitlink short url to original link.
  • bitly.getCountries(bitlink, unit, units, size) - Get metrics about the countries referring click traffic to a single Bitlink.
  • bitly.getReferrers(bitlink, unit, units, size) - Get metrics about the referrers referring click traffic to a single Bitlink.
  • bitly.getReferrersDomains(bitlink, unit, units, size) - Get metrics about rollup the click counts to a referrer about a single Bitlink.
  • bitly.getClickSummary(bitlink, unit, units, size) - Get click counts for a specified Bitlink, This rolls up all the data
  • bitly.getClick(bitlink, unit, units, size) - Get click counts for a specified Bitlink, This returns an array with clicks based on a date.
  • bitly.getLinkInfo(bitlink) - Get information for a Bitlink.

πŸ“Œ Pretty-Link only supports Bitly's v4 API, not Compatible v3 API

TinyURL

  • tinyUrl.short(longUrl) - Convert a long url to short url.

PicSee

PicSee Official API docs

  • picsee.init(AccessToken) - Initialize AccessToken.
  • picsee.short(longUrl) - Convert a long url to short url.
  • picsee.customShortUrlMeta(longUrl, title, description, imageUrl) - Custom short url meta info.
  • picsee.getOverview(linkId) - Get short url overview info, PicSee link id, like this 'KK6X6'.

reurl

reurl Official API docs

  • reurl.init(AccessToken) - Initialize AccessToken.
  • reurl.short(longUrl) - Convert a long url to short url.

Cutt.ly

Cutt.ly Official API docs

  • cuttly.init(AccessToken) - Initialize AccessToken.
  • cuttly.short(longUrl) - Convert a long url to short url.

Pixnet0rz.tw

  • pixnet0rz.short(longUrl) - Convert a long url to short url.

Demo

Demo

Test

⚠️ To run Mocha tests type npm test. Please note the test will fail if you don't replace your own API key or Access Token.

Contributing

πŸŽ‰ Welcome to Directly send PRs!

License

MIT

pretty-link's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar dmsavchik avatar stu01509 avatar

Watchers

 avatar  avatar

Forkers

dmsavchik

pretty-link's Issues

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.