# @ffz/link-service

> A service that visits links and returns well structured, consumable metadata for clients to use for building rich embeds and tool-tips.

Latest version **5.4.0** (published 2024-10-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ffz/link-service
pnpm add @ffz/link-service
yarn add @ffz/link-service
bun add @ffz/link-service
```

## Health

**Score 40/100 (D)** — status: stable.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 5.4.0 |
| Published | 2024-10-14 |
| First published | 2020-08-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 11 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | SirStendec |
| Maintainers | sirstendec |

## Links

- npm: https://www.npmjs.com/package/@ffz/link-service
- Repository: https://github.com/frankerfacez/link-service
- Homepage: https://github.com/frankerfacez/link-service#readme
- Issues: https://github.com/frankerfacez/link-service/issues
- npm.io page: https://npm.io/package/@ffz/link-service

## Dependencies (11)

- [dayjs](https://npm.io/package/dayjs.md) ^1.11.7
- [tldjs](https://npm.io/package/tldjs.md) ^2.3.1
- [cheerio](https://npm.io/package/cheerio.md) 1.0.0-rc.12
- [mmmagic](https://npm.io/package/mmmagic.md) ^0.5.3
- [cookiejar](https://npm.io/package/cookiejar.md) ^2.1.4
- [mnemonist](https://npm.io/package/mnemonist.md) ^0.39.5
- [@atproto/api](https://npm.io/package/@atproto/api.md) ^0.6.20
- [twitter-text](https://npm.io/package/twitter-text.md) ^3.1.0
- [simple-oauth2](https://npm.io/package/simple-oauth2.md) ^4.3.0
- [source-map-support](https://npm.io/package/source-map-support.md) ^0.5.21
- [content-disposition](https://npm.io/package/content-disposition.md) ^0.5.4

## Recent versions

- 5.4.0 (latest) — 2024-10-14
- 5.3.2 — 2023-12-19
- 5.3.1 — 2023-12-19
- 5.3.0 — 2023-12-19
- 5.2.0 — 2023-12-14
- 5.1.0 — 2023-10-28
- 5.0.0 — 2023-10-20
- 4.0.1 — 2023-09-28
- 4.0.0 — 2023-09-27
- 3.0.0 — 2023-04-10
- 2.4.1 — 2023-01-20
- 2.4.0 — 2023-01-20
- 2.3.0 — 2023-01-19
- 2.2.0 — 2021-09-08
- 2.1.1 — 2021-09-03
- … 16 more at https://npm.io/package/@ffz/link-service/versions

## README

# @ffz/link-service

[![NPM Version](https://img.shields.io/npm/v/@ffz/link-service.svg?style=flat)](https://npmjs.org/package/@ffz/link-service)

Link resolver service for [FrankerFaceZ](https://www.frankerfacez.com/).

- Supports site-specific modules for refining responses
- Falls back to `<meta>` tags and HTML scraping if necessary
- Keeps track of page redirects
- Support for safety checking individual URLs, including
  via Google SafeBrowsing if configured.
- Support for caching, integrated with redirect handling

* * *

## Use as a Dependency

```bash
$ npm install @ffz/link-service --save
```

```javascript
import LinkService from '@ffz/link-service';

const service = new LinkService(config);

const embed = await service.resolve(url);
```


## Getting Started Developing

This project uses the [pnpm](https://pnpm.io/) package manager. To get
everything you need:

1. Install node.js and [pnpm](https://pnpm.io/)
2. Run `pnpm install` within the project's directory.

From there, you can use pnpm to build the service from source by running
`pnpm build`, build documentation with `pnpm docs`, and start the
development tool.

The built-in development tool both provides an interactive shell and
that runs an HTTPS server the client can communicate with for testing.
To start it, just run:

```bash
$ pnpm start
```

By default, this will start the HTTPS server listening on port 8002
with a self-signed certificate. In order to use this server for
developing with FrankerFaceZ, you'll need to ensure your browser will
accept self-signed certificates for localhost. That may involve
visiting [https://localhost:8002](https://localhost:8002) in your
browser and making an exception for the certificate.

Once you've done that, you can use either the FrankerFaceZ client
itself or our documentation's [Testing Tool](https://docs.frankerfacez.com/dev/link-preview/tester)
to start making requests to the local server.

When using the FrankerFaceZ client, you'll need to open the control
center to `Debugging > Data Sources` and change the `Link Resolver`
to `Local Dev Server`.

When using the documentation Testing Tool, just change the `Provider`
to `Local Dev Server`.

At that point, you just pick a URL for testing or enter a custom
URL and you go to work implementing your custom resolver.


### Configuration

If you create a file named `config.json`, that file will be used to
configure the `LinkService` instance from the shell script. You should
use this file to install API keys for local testing, if necessary.


## Remaining Tasks

* Add more services
* Finish Documentation
* Write Tests


## Documentation

* [API Documentation](https://frankerfacez.github.io/Link-Service/)


## Tests

Run tests using `pnpm test`.


## Contributions and Support

Please submit all issues and pull requests to the [FrankerFaceZ/link-service](https://github.com/frankerfacez/link-service) repository.

---
_Source: https://npm.io/package/@ffz/link-service · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
