https://github.com/johan-perso/moreshort
A simple URL shortener module, using multiple services to shorten URLs
https://github.com/johan-perso/moreshort
isgd link-shortener shortener shorturl trim url-shortener vgd
Last synced: 10 months ago
JSON representation
A simple URL shortener module, using multiple services to shorten URLs
- Host: GitHub
- URL: https://github.com/johan-perso/moreshort
- Owner: johan-perso
- License: mit
- Created: 2024-01-13T21:47:56.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-06-04T21:01:14.000Z (about 1 year ago)
- Last Synced: 2025-08-17T13:35:59.868Z (10 months ago)
- Topics: isgd, link-shortener, shortener, shorturl, trim, url-shortener, vgd
- Language: JavaScript
- Homepage: https://npmjs.com/package/moreshort
- Size: 32.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.fr.md
- License: LICENSE
Awesome Lists containing this project
README
###### English version [here](https://github.com/johan-perso/moreshort/blob/main/README.md).
# MoreShort
Une librairie capable de raccourcir des liens via une simple fonction, en utilisant de multiples services possédant des noms de domaines courts.
## Domaines/services supportés
| [rfrr.fr](https://unshort.johanstick.fr) | [llui.site](https://unshort.johanstick.fr) |
|------------------------------------------------------|-------------------------------------------------|
| [is.gd](https://is.gd) | [v.gd](https://v.gd) |
| [s.oriondev.fr](https://quecto.oriondev.fr) | [liba.ro](https://liba.ro) |
| [s.3vm.cl](https://unshort.johanstick.fr) | [s.erc.hr](https://unshort.johanstick.fr) |
| [s.585.eu](https://unshort.johanstick.fr) | [s.jib.ar](https://unshort.johanstick.fr) |
| [s.ahpc.fi](https://unshort.johanstick.fr) | [s.acme.si](https://unshort.johanstick.fr) |
| [s.coute.au](https://unshort.johanstick.fr) | [s.fronturi.ro](https://unshort.johanstick.fr) |
| [shor.vercel.app](https://unshort.johanstick.fr) | |
## Installation
### NodeJS
> Aucun support n'est garanti pour les anciennes versions de NodeJS.
```bash
# Avec npm
npm i moreshort
# Ou avec pnpm
pnpm i moreshort
```
```js
const moreshort = require('moreshort')
console.log(moreshort) // Retourne des informations sur la librairie
console.log(await moreshort.short('https://google.com')) // Retourne un lien raccourci
```
### Navigateur
```html
```
```js
console.log(moreshort) // Retourne des informations sur la librairie
console.log(await moreshort.short('https://google.com')) // Retourne un lien raccourci
```
> Dans le navigateur, vous pouvez utiliser la fonction `short` directement, sans avoir à utiliser `moreshort.short`.
## Utilisation de la méthode principale
La fonction principale dispose de 3 arguments :
* `url` : L'URL à raccourcir *(string)*
* `provider` : Nom de domaine du service à utiliser *(string)*
* > Vous pouvez obtenir la liste des services disponibles avec `moreshort.servicesDomains`
* `options` :
* `shortcode` : Code court à utiliser *(string)*
* > Sera présent dans l'URL raccourci, après le slash *(ex: https://is.gd/shortcode)*
* > Seuls certains services supportent cette fonctionnalité, `moreshort.servicesInfos` dispose d'une propriété booléenne `shortcode` pour chaque service
* `replaceWhenErrors` : Remplace automatiquement le service utilisé par un autre en cas d'erreur *(bool)*
**Exemple :**
```js
const moreshort = require('moreshort')
console.log(await moreshort.short('https://google.com')) // Raccourci avec un service aléatoire
console.log(await moreshort.short('https://google.com', 'is.gd')) // Raccourci avec le service is.gd
console.log(await moreshort.short('https://google.com', 'is.gd', { shortcode: 'google' })) // Raccourci avec le service is.gd et le code court "google"
```
## Licence
MIT © [Johan](https://johanstick.fr). [Soutenez ce projet](https://johanstick.fr/#donate) si vous souhaitez m'aider 💙