GithubHelp home page GithubHelp logo

johan-perso / moreshort Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 19 KB

A simple URL shortener module, using multiple services to shorten URLs

Home Page: https://npmjs.com/package/moreshort

License: MIT License

JavaScript 100.00%
isgd link-shortener shortener shorturl trim url-shortener vgd

moreshort's Introduction

Version française ici.

MoreShort

A library capable of shortening links through a simple function, using multiple services with short domain names.

Supported domains/services

is.gd v.gd
liba.ro bitly.ws
xy2.eu tinyurl.mobi
s.oriondev.fr s.3vm.cl
s.ahpc.fi s.acme.si
s.3play.cl s.fronturi.ro
shor.vercel.app ptdrr.com
s.miapi.cl s.erc.hr
s.jib.ar s.coute.au
mdrr.fr

Installation

NodeJS

No support is guaranteed for older versions of NodeJS.

# With npm
npm i moreshort

# Or with pnpm
pnpm i moreshort
const moreshort = require('moreshort')

console.log(moreshort) // Returns information about the library
console.log(await moreshort.short('https://google.com')) // Returns a shortened link

Browser

<script src="https://cdn.jsdelivr.net/npm/moreshort/dist/browser.js"></script>
console.log(moreshort) // Returns information about the library
console.log(await moreshort.short('https://google.com')) // Returns a shortened link

In the browser, you can use the short function directly, without needing to use moreshort.short.

Using the main method

The main function has 3 arguments:

  • url : The URL to shorten (string)
  • provider : Domain name of the service to use (string)
  • You can get the list of available services with moreshort.servicesDomains

  • shortcode : Short code to use (string)
  • Will be present in the shortened URL, after the slash (e.g. https://is.gd/shortcode)

  • Only some services support this feature; moreshort.servicesInfos has a boolean property shortcode for each service

Example :

const moreshort = require('moreshort')

console.log(await moreshort.short('https://google.com')) // Shortened with a random service
console.log(await moreshort.short('https://google.com', 'is.gd')) // Shortened with the is.gd service
console.log(await moreshort.short('https://google.com', 'is.gd', 'google')) // Shortened with the is.gd service and the short code "google"

License

MIT © Johan

moreshort's People

Contributors

johan-perso avatar

Stargazers

 avatar

Watchers

 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.