-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { URL } from 'node:url'; | ||
import type { default as Summary } from './summary.js'; | ||
export type GeneralScrapingOptions = { | ||
lang?: string | null; | ||
userAgent?: string; | ||
responseTimeout?: number; | ||
operationTimeout?: number; | ||
contentLengthLimit?: number; | ||
contentLengthRequired?: boolean; | ||
}; | ||
declare const _default: (_url: URL | string, opts?: GeneralScrapingOptions) => Promise<Summary | null>; | ||
export default _default; | ||
//# sourceMappingURL=general.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* summaly | ||
* https://github.com/misskey-dev/summaly | ||
*/ | ||
import type { FastifyInstance } from 'fastify'; | ||
import type * as Got from 'got'; | ||
import type { SummalyPlugin } from './iplugin.js'; | ||
import type { SummalyResult } from './summary.js'; | ||
export * from './iplugin.js'; | ||
export type SummalyOptions = { | ||
/** | ||
* Accept-Language for the request | ||
*/ | ||
lang?: string | null; | ||
/** | ||
* Whether follow redirects | ||
*/ | ||
followRedirects?: boolean; | ||
/** | ||
* Custom Plugins | ||
*/ | ||
plugins?: SummalyPlugin[]; | ||
/** | ||
* Custom HTTP agent | ||
*/ | ||
agent?: Got.Agents; | ||
/** | ||
* User-Agent for the request | ||
*/ | ||
userAgent?: string; | ||
/** | ||
* Response timeout. | ||
* Set timeouts for each phase, such as host name resolution and socket communication. | ||
*/ | ||
responseTimeout?: number; | ||
/** | ||
* Operation timeout. | ||
* Set the timeout from the start to the end of the request. | ||
*/ | ||
operationTimeout?: number; | ||
/** | ||
* Maximum content length. | ||
* If 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). | ||
*/ | ||
contentLengthLimit?: number; | ||
/** | ||
* Content length required. | ||
* If set to true, it will be an error if the other server does not return content-length. | ||
*/ | ||
contentLengthRequired?: boolean; | ||
}; | ||
export declare const summalyDefaultOptions: SummalyOptions; | ||
/** | ||
* Summarize an web page | ||
*/ | ||
export declare const summaly: (url: string, options?: SummalyOptions) => Promise<SummalyResult>; | ||
export default function (fastify: FastifyInstance, options: SummalyOptions, done: (err?: Error) => void): void; | ||
//# sourceMappingURL=index.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type { URL } from 'node:url'; | ||
import type { GeneralScrapingOptions } from '@/general.js'; | ||
import type Summary from './summary.js'; | ||
export interface SummalyPlugin { | ||
test: (url: URL) => boolean; | ||
summarize: (url: URL, opts?: GeneralScrapingOptions) => Promise<Summary | null>; | ||
} | ||
//# sourceMappingURL=iplugin.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import type { SummalyPlugin } from '@/iplugin.js'; | ||
export declare const plugins: SummalyPlugin[]; | ||
//# sourceMappingURL=_.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { URL } from 'node:url'; | ||
import type summary from '../summary.js'; | ||
export declare function test(url: URL): boolean; | ||
export declare function summarize(url: URL): Promise<summary>; | ||
//# sourceMappingURL=amazon.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import type summary from '../summary.js'; | ||
export declare function test(url: URL): boolean; | ||
export declare function summarize(url: URL): Promise<summary>; | ||
//# sourceMappingURL=bluesky.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { URL } from 'node:url'; | ||
import { type GeneralScrapingOptions } from '../general.js'; | ||
import type Summary from '../summary.js'; | ||
export declare function test(url: URL): boolean; | ||
export declare function summarize(url: URL, opts?: GeneralScrapingOptions): Promise<Summary | null>; | ||
//# sourceMappingURL=branchio-deeplinks.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { URL } from 'node:url'; | ||
import type summary from '../summary.js'; | ||
export declare function test(url: URL): boolean; | ||
export declare function summarize(url: URL): Promise<summary>; | ||
//# sourceMappingURL=wikipedia.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
type Summary = { | ||
/** | ||
* The title of that web page | ||
*/ | ||
title: string | null; | ||
/** | ||
* The url of the icon of that web page | ||
*/ | ||
icon: string | null; | ||
/** | ||
* The description of that web page | ||
*/ | ||
description: string | null; | ||
/** | ||
* The url of the thumbnail of that web page | ||
*/ | ||
thumbnail: string | null; | ||
/** | ||
* The name of site of that web page | ||
*/ | ||
sitename: string | null; | ||
/** | ||
* The player of that web page | ||
*/ | ||
player: Player; | ||
/** | ||
* Possibly sensitive | ||
*/ | ||
sensitive?: boolean; | ||
/** | ||
* The url of the ActivityPub representation of that web page | ||
*/ | ||
activityPub: string | null; | ||
}; | ||
export type SummalyResult = Summary & { | ||
/** | ||
* The actual url of that web page | ||
*/ | ||
url: string; | ||
}; | ||
export default Summary; | ||
export type Player = { | ||
/** | ||
* The url of the player | ||
*/ | ||
url: string | null; | ||
/** | ||
* The width of the player | ||
*/ | ||
width: number | null; | ||
/** | ||
* The height of the player | ||
*/ | ||
height: number | null; | ||
/** | ||
* The allowed permissions of the iframe | ||
*/ | ||
allow: string[]; | ||
}; | ||
//# sourceMappingURL=summary.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export default function (_title: string, _siteName?: string | null): string; | ||
//# sourceMappingURL=cleanup-title.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export default function (_s: string | null | undefined, max: number): string; | ||
//# sourceMappingURL=clip.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type * as Got from 'got'; | ||
/** | ||
* Detect HTML encoding | ||
* @param response Response | ||
* @returns encoding | ||
*/ | ||
export declare function detectEncoding(response: Got.Response<string>): string; | ||
export declare function toUtf8(body: Buffer, encoding: string): string; | ||
//# sourceMappingURL=encoding.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as cheerio from 'cheerio'; | ||
import * as Got from 'got'; | ||
export declare let agent: Got.Agents; | ||
export declare function setAgent(_agent: Got.Agents): void; | ||
export type GotOptions = { | ||
url: string; | ||
method: 'GET' | 'POST' | 'HEAD'; | ||
body?: string; | ||
headers: Record<string, string | undefined>; | ||
typeFilter?: RegExp; | ||
responseTimeout?: number; | ||
operationTimeout?: number; | ||
contentLengthLimit?: number; | ||
contentLengthRequired?: boolean; | ||
}; | ||
export declare const DEFAULT_RESPONSE_TIMEOUT: number; | ||
export declare const DEFAULT_OPERATION_TIMEOUT: number; | ||
export declare const DEFAULT_MAX_RESPONSE_SIZE: number; | ||
export declare const DEFAULT_BOT_UA: string; | ||
export declare function scpaping(url: string, opts?: { | ||
lang?: string; | ||
userAgent?: string; | ||
responseTimeout?: number; | ||
operationTimeout?: number; | ||
contentLengthLimit?: number; | ||
contentLengthRequired?: boolean; | ||
}): Promise<{ | ||
body: string; | ||
$: cheerio.CheerioAPI; | ||
response: Got.Response<string>; | ||
}>; | ||
export declare function get(url: string): Promise<string>; | ||
export declare function head(url: string): Promise<Got.Response<string>>; | ||
//# sourceMappingURL=got.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export declare class StatusError extends Error { | ||
name: string; | ||
statusCode?: number; | ||
statusMessage?: string; | ||
isPermanentError: boolean; | ||
constructor(message: string, statusCode?: number, statusMessage?: string); | ||
} | ||
//# sourceMappingURL=status-error.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,9 @@ | |
"packageManager": "[email protected]", | ||
"files": ["dist", "LICENSE"], | ||
"scripts": { | ||
"build": "swc src -d dist -D --strip-leading-paths", | ||
"build": "pnpm run build:swc && pnpm run build:dts", | ||
"build:swc": "swc src -d dist -D --strip-leading-paths", | ||
"build:dts": "tsc --outDir dist --declaration true --emitDeclarationOnly true --declarationMap true", | ||
"clean": "node scripts/clean.cjs", | ||
"format": "biome check --write", | ||
"check": "pnpm run build && biome check", | ||
|