This commit is contained in:
tamaina 2023-02-12 12:09:17 +00:00
parent c957237176
commit 120a446ac9
2 changed files with 28 additions and 12 deletions

View File

@ -1,28 +1,42 @@
summaly
================================================================
[![Greenkeeper badge](https://badges.greenkeeper.io/syuilo/summaly.svg)](https://greenkeeper.io/)
[![][npm-badge]][npm-link]
[![][mit-badge]][mit]
[![][travis-badge]][travis-link]
[![][himawari-badge]][himasaku]
[![][sakurako-badge]][himasaku]
[![NPM](https://nodei.co/npm/summaly.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/summaly)
Get any web page's summary. [Try it out](https://runkit.com/npm/summaly)
Installation
----------------------------------------------------------------
`$ npm install summaly`
```
npm install git+https://github.com/misskey-dev/summalygit
```
Usage
----------------------------------------------------------------
``` javascript
As a function:
```javascript
import { summaly } from 'summaly';
summaly(url[, opts])
```
As Fastify plugin:
(will listen `GET` of `/url`)
```javascript
import Summaly from 'summaly';
fastify.register(Summaly[, opts])
```
Run the server:
```
npm run build
npm run serve
```
### Options
| Property | Type | Description | Default |
@ -43,6 +57,8 @@ interface IPlugin {
A Promise of an Object that contains properties below:
※ Almost all values are nullable. player shoud not be null.
#### Root
| Property | Type | Description |
@ -66,7 +82,7 @@ A Promise of an Object that contains properties below:
### Example
``` javascript
import summaly from 'summaly';
import { summaly } from 'summaly';
const summary = await summaly('https://www.youtube.com/watch?v=NMIEAhH_fTU');

View File

@ -92,7 +92,7 @@ export default function (fastify: FastifyInstance, options: Options, done: (err?
url?: string;
lang?: string;
};
}>('/', async (req, reply) => {
}>('/url', async (req, reply) => {
const url = req.query.url as string;
if (url == null) {
return reply.status(400).send({