mirror of
https://github.com/misskey-dev/summaly.git
synced 2025-08-03 23:06:37 +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
|
||||
------------------
|
||||
* Dependencies update
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "summaly",
|
||||
"version": "2.0.4",
|
||||
"version": "2.0.5",
|
||||
"description": "Get web page's summary",
|
||||
"author": "syuilo <i@syuilo.com>",
|
||||
"license": "MIT",
|
||||
|
@ -44,17 +44,13 @@ const defaultOptions = {
|
||||
|
||||
/**
|
||||
* 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> => {
|
||||
const opts = Object.assign(defaultOptions, options);
|
||||
|
||||
const plugins = builtinPlugins.concat(opts.plugins || []);
|
||||
|
||||
// Follow redirects
|
||||
const actualUrl = opts.followRedirects ? await tracer(url) : url;
|
||||
const actualUrl = opts.followRedirects ? await tracer(url).catch(() => url) : url;
|
||||
|
||||
const _url = URL.parse(actualUrl, true);
|
||||
|
||||
|
Reference in New Issue
Block a user