Socket
Book a DemoInstallSign in
Socket

@misskey-dev/summaly

Package Overview
Dependencies
Maintainers
6
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@misskey-dev/summaly

Get web page's summary

5.2.3
latest
Source
npmnpm
Version published
Maintainers
6
Created
Source

summaly

Installation

npm install @misskey-dev/summaly

Usage

As a function:

import { summaly } from 'summaly';

summaly(url[, opts])

As Fastify plugin: (will listen GET of /)

import Summaly from 'summaly';

fastify.register(Summaly[, opts])

Run the server:

git clone https://github.com/misskey-dev/summaly.git
cd summaly
NODE_ENV=development npm install
npm run build
npm run serve

opts (SummalyOptions)

PropertyTypeDescriptionDefault
langstringAccept-Language for the requestnull
followRedirectsbooleanWhether follow redirectstrue
pluginsplugin[] (see below)Custom pluginsnull
agentGot.AgentsCustom HTTP agent (see below)null
userAgentstringUser-Agent for the requestSummalyBot/[version]
responseTimeoutnumberSet timeouts for each phase, such as host name resolution and socket communication.20000
operationTimeoutnumberSet the timeout from the start to the end of the request.60000
contentLengthLimitnumberIf set to true, an error will occur if the content-length value returned from the other server is larger than this parameter (or if the received body size exceeds this parameter).10485760
contentLengthRequiredbooleanIf set to true, it will be an error if the other server does not return content-length.false

Plugin

interface SummalyPlugin {
	test: (url: URL) => boolean;
	summarize: (url: URL) => Promise<Summary>;
}

urls are WHATWG URL since v4.

Custom HTTP agent for proxy

You can specify agents to be passed to Got for proxy use, etc.
https://github.com/sindresorhus/got/blob/v12.6.0/documentation/tips.md#proxying

⚠️If you set some agent, local IP rejecting will not work.⚠️
(Summaly usually rejects local IPs.)

(Summaly currently does not support http2.)

Returns

A Promise of an Object that contains properties below:

※ Almost all values are nullable. player should not be null.

SummalyResult

PropertyTypeDescription
titlestring | nullThe title of the web page
iconstring | nullThe url of the icon of the web page
descriptionstring | nullThe description of the web page
thumbnailstring | nullThe url of the thumbnail of the web page
sitenamestring | nullThe name of the web site
playerPlayerThe player of the web page
sensitivebooleanWhether the url is sensitive
activityPubstring | nullThe url of the ActivityPub representation of that web page
fediverseCreatorstring | nullThe pages fediverse handle
urlstringThe url of the web page

Summary

Omit<SummalyResult, "url">

Player

PropertyTypeDescription
urlstring | nullThe url of the player
widthnumber | nullThe width of the player
heightnumber | nullThe height of the player
allowstring[]The names of the allowed permissions for iframe

Currently the possible items in allow are:

  • autoplay
  • clipboard-write
  • fullscreen
  • encrypted-media
  • picture-in-picture
  • web-share

See Permissions Policy in MDN for details of them.

Example

import { summaly } from 'summaly';

const summary = await summaly('https://www.youtube.com/watch?v=NMIEAhH_fTU');

console.log(summary);

will be ... ↓

{
	"title": "【アイドルマスター】「Stage Bye Stage」(歌:島村卯月、渋谷凛、本田未央)",
	"icon": "https://www.youtube.com/s/desktop/711fd789/img/logos/favicon.ico",
	"description": "Website▶https://columbia.jp/idolmaster/Playlist▶https://www.youtube.com/playlist?list=PL83A2998CF3BBC86D2018年7月18日発売予定THE IDOLM@STER CINDERELLA GIRLS CG STAR...",
	"thumbnail": "https://i.ytimg.com/vi/NMIEAhH_fTU/maxresdefault.jpg",
	"player": {
		"url": "https://www.youtube.com/embed/NMIEAhH_fTU?feature=oembed",
		"width": 200,
		"height": 113,
		"allow": [
			"autoplay",
			"clipboard-write",
			"encrypted-media",
			"picture-in-picture",
			"web-share",
			"fullscreen",
		]
	},
	"sitename": "YouTube",
	"sensitive": false,
	"activityPub": null,
	"url": "https://www.youtube.com/watch?v=NMIEAhH_fTU"
}

Testing

npm run test

License

MIT

FAQs

Package last updated on 19 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.