mirror of
https://github.com/misskey-dev/summaly.git
synced 2025-05-03 04:37:24 +09:00
✌️
This commit is contained in:
parent
c957237176
commit
120a446ac9
38
README.md
38
README.md
@ -1,28 +1,42 @@
|
||||
summaly
|
||||
================================================================
|
||||
|
||||
[](https://greenkeeper.io/)
|
||||
|
||||
[![][npm-badge]][npm-link]
|
||||
[![][mit-badge]][mit]
|
||||
[![][travis-badge]][travis-link]
|
||||
[![][himawari-badge]][himasaku]
|
||||
[![][sakurako-badge]][himasaku]
|
||||
|
||||
[](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');
|
||||
|
||||
|
@ -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({
|
||||
|
Loading…
x
Reference in New Issue
Block a user