mirror of
https://github.com/misskey-dev/summaly.git
synced 2025-05-29 17:37:17 +09:00
Follow lint
This commit is contained in:
parent
9374664cbc
commit
2b01979fb2
@ -1,10 +1,11 @@
|
||||
import * as URL from 'url';
|
||||
|
||||
import * as client from 'cheerio-httpcli';
|
||||
import summary from '../summary';
|
||||
|
||||
client.set('referer', false);
|
||||
client.set('timeout', 10000);
|
||||
|
||||
export function test(url: URL.Url) {
|
||||
export function test(url: URL.Url): boolean {
|
||||
return url.hostname === 'www.amazon.com' ||
|
||||
url.hostname === 'www.amazon.co.jp' ||
|
||||
url.hostname === 'www.amazon.ca' ||
|
||||
@ -18,10 +19,10 @@ export function test(url: URL.Url) {
|
||||
url.hostname === 'www.amazon.nl' ||
|
||||
url.hostname === 'www.amazon.cn' ||
|
||||
url.hostname === 'www.amazon.in' ||
|
||||
url.hostname === 'www.amazon.au'
|
||||
url.hostname === 'www.amazon.au';
|
||||
};
|
||||
|
||||
export async function summarize(url: URL.Url) {
|
||||
export async function summarize(url: URL.Url): Promise<summary> {
|
||||
const res = await client.fetch(url.href);
|
||||
const $ = res.$;
|
||||
|
||||
|
@ -1,15 +1,16 @@
|
||||
import * as URL from 'url';
|
||||
import * as request from 'request';
|
||||
import * as debug from 'debug';
|
||||
import summary from '../summary';
|
||||
import clip from './../utils/clip';
|
||||
|
||||
const log = debug('summaly:plugins:wikipedia');
|
||||
|
||||
export function test(url: URL.Url) {
|
||||
export function test(url: URL.Url): boolean {
|
||||
return /\.wikipedia\.org$/.test(url.hostname);
|
||||
};
|
||||
|
||||
export function summarize(url: URL.Url) {
|
||||
export function summarize(url: URL.Url): Promise<summary> {
|
||||
return new Promise((res, rej) => {
|
||||
const lang = url.host.split('.')[0];
|
||||
const title = url.pathname.split('/')[2];
|
||||
|
@ -23,6 +23,6 @@ type Summary = {
|
||||
* The title of that web page
|
||||
*/
|
||||
title: string;
|
||||
}
|
||||
};
|
||||
|
||||
export default Summary;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import nullOrEmpty from './null-or-empty';
|
||||
|
||||
export default function(s: string, max: number) {
|
||||
export default function(s: string, max: number): string {
|
||||
if (nullOrEmpty(s)) {
|
||||
return s;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
export default function(val: string) {
|
||||
export default function(val: string): boolean {
|
||||
if (val === undefined) {
|
||||
return true;
|
||||
} else if (val === null) {
|
||||
|
@ -61,7 +61,7 @@
|
||||
"radix": true,
|
||||
"semicolon": true,
|
||||
"switch-default": false,
|
||||
"triple-equals": true,
|
||||
"triple-equals": false,
|
||||
"typedef": [true,
|
||||
"call-signature",
|
||||
"property-declaration"
|
||||
|
Loading…
x
Reference in New Issue
Block a user