mirror of
https://github.com/misskey-dev/summaly.git
synced 2025-08-07 00:33:59 +09:00
Handle error
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
2.0.5 / 2018-05-18
|
||||||
|
------------------
|
||||||
|
* Fix bug
|
||||||
|
|
||||||
2.0.4 / 2018-04-18
|
2.0.4 / 2018-04-18
|
||||||
------------------
|
------------------
|
||||||
* Dependencies update
|
* Dependencies update
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "summaly",
|
"name": "summaly",
|
||||||
"version": "2.0.4",
|
"version": "2.0.5",
|
||||||
"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",
|
||||||
|
@ -44,17 +44,13 @@ const defaultOptions = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Summarize an web page
|
* Summarize an web page
|
||||||
* @param {string} url URL of web page you want to summarize
|
|
||||||
* @param {Options?} options The options
|
|
||||||
* @return {Promise<Result>} Promised summary
|
|
||||||
*/
|
*/
|
||||||
export default async (url: string, options?: Options): Promise<Result> => {
|
export default async (url: string, options?: Options): Promise<Result> => {
|
||||||
const opts = Object.assign(defaultOptions, options);
|
const opts = Object.assign(defaultOptions, options);
|
||||||
|
|
||||||
const plugins = builtinPlugins.concat(opts.plugins || []);
|
const plugins = builtinPlugins.concat(opts.plugins || []);
|
||||||
|
|
||||||
// Follow redirects
|
const actualUrl = opts.followRedirects ? await tracer(url).catch(() => url) : url;
|
||||||
const actualUrl = opts.followRedirects ? await tracer(url) : url;
|
|
||||||
|
|
||||||
const _url = URL.parse(actualUrl, true);
|
const _url = URL.parse(actualUrl, true);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user