mirror of
https://github.com/misskey-dev/summaly.git
synced 2025-08-07 00:33:59 +09:00
[BREAKING] Plugin: summary --> summarize (2.0.0)
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2.0.0 / 2017-02-08
|
||||||
|
------------------
|
||||||
|
* **[BREAKING CHANGE] Renamed: Plugins: Method `summary` is now `summarize`**
|
||||||
|
* Some refactors
|
||||||
|
|
||||||
1.6.1 / 2017-02-06
|
1.6.1 / 2017-02-06
|
||||||
------------------
|
------------------
|
||||||
* Fix the incorrect type definition
|
* Fix the incorrect type definition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "summaly",
|
"name": "summaly",
|
||||||
"version": "1.6.1",
|
"version": "2.0.0",
|
||||||
"description": "Get web page's summary",
|
"description": "Get web page's summary",
|
||||||
"author": "syuilo <i@syuilo.com>",
|
"author": "syuilo <i@syuilo.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -60,7 +60,7 @@ export default async (url: string, options?: Options): Promise<Result> => {
|
|||||||
const match = plugins.filter(plugin => plugin.test(_url))[0];
|
const match = plugins.filter(plugin => plugin.test(_url))[0];
|
||||||
|
|
||||||
// Get summary
|
// Get summary
|
||||||
const summary = await (match ? match.summary : general)(_url);
|
const summary = await (match ? match.summarize : general)(_url);
|
||||||
|
|
||||||
return Object.assign(summary, {
|
return Object.assign(summary, {
|
||||||
url: actualUrl
|
url: actualUrl
|
||||||
|
@ -3,7 +3,7 @@ import Summary from './summary';
|
|||||||
|
|
||||||
interface IPlugin {
|
interface IPlugin {
|
||||||
test: (url: URL.Url) => boolean;
|
test: (url: URL.Url) => boolean;
|
||||||
summary: (url: URL.Url) => Promise<Summary>;
|
summarize: (url: URL.Url) => Promise<Summary>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default IPlugin;
|
export default IPlugin;
|
||||||
|
@ -21,7 +21,7 @@ export function test(url: URL.Url) {
|
|||||||
url.hostname === 'www.amazon.au'
|
url.hostname === 'www.amazon.au'
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function summary(url: URL.Url) {
|
export async function summarize(url: URL.Url) {
|
||||||
const res = await client.fetch(url.href);
|
const res = await client.fetch(url.href);
|
||||||
const $ = res.$;
|
const $ = res.$;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ export function test(url: URL.Url) {
|
|||||||
return /\.wikipedia\.org$/.test(url.hostname);
|
return /\.wikipedia\.org$/.test(url.hostname);
|
||||||
};
|
};
|
||||||
|
|
||||||
export function summary(url: URL.Url) {
|
export function summarize(url: URL.Url) {
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
const lang = url.host.split('.')[0];
|
const lang = url.host.split('.')[0];
|
||||||
const title = url.pathname.split('/')[2];
|
const title = url.pathname.split('/')[2];
|
||||||
|
Reference in New Issue
Block a user