mirror of
https://github.com/misskey-dev/summaly.git
synced 2025-05-03 12:47:31 +09:00
✌️
This commit is contained in:
parent
c957237176
commit
120a446ac9
38
README.md
38
README.md
@ -1,28 +1,42 @@
|
|||||||
summaly
|
summaly
|
||||||
================================================================
|
================================================================
|
||||||
|
|
||||||
[](https://greenkeeper.io/)
|
|
||||||
|
|
||||||
[![][npm-badge]][npm-link]
|
|
||||||
[![][mit-badge]][mit]
|
[![][mit-badge]][mit]
|
||||||
[![][travis-badge]][travis-link]
|
|
||||||
[![][himawari-badge]][himasaku]
|
[![][himawari-badge]][himasaku]
|
||||||
[![][sakurako-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
|
Installation
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
`$ npm install summaly`
|
```
|
||||||
|
npm install git+https://github.com/misskey-dev/summalygit
|
||||||
|
```
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
``` javascript
|
As a function:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { summaly } from 'summaly';
|
||||||
|
|
||||||
summaly(url[, opts])
|
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
|
### Options
|
||||||
|
|
||||||
| Property | Type | Description | Default |
|
| Property | Type | Description | Default |
|
||||||
@ -43,6 +57,8 @@ interface IPlugin {
|
|||||||
|
|
||||||
A Promise of an Object that contains properties below:
|
A Promise of an Object that contains properties below:
|
||||||
|
|
||||||
|
※ Almost all values are nullable. player shoud not be null.
|
||||||
|
|
||||||
#### Root
|
#### Root
|
||||||
|
|
||||||
| Property | Type | Description |
|
| Property | Type | Description |
|
||||||
@ -66,7 +82,7 @@ A Promise of an Object that contains properties below:
|
|||||||
### Example
|
### Example
|
||||||
|
|
||||||
``` javascript
|
``` javascript
|
||||||
import summaly from 'summaly';
|
import { summaly } from 'summaly';
|
||||||
|
|
||||||
const summary = await summaly('https://www.youtube.com/watch?v=NMIEAhH_fTU');
|
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;
|
url?: string;
|
||||||
lang?: string;
|
lang?: string;
|
||||||
};
|
};
|
||||||
}>('/', async (req, reply) => {
|
}>('/url', async (req, reply) => {
|
||||||
const url = req.query.url as string;
|
const url = req.query.url as string;
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
return reply.status(400).send({
|
return reply.status(400).send({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user