mirror of
https://github.com/misskey-dev/summaly.git
synced 2025-05-18 20:17:21 +09:00
Merge pull request #20 from armchair-philosophy/update_cheerio-httpcli
follow cheerio-httpcli update
This commit is contained in:
commit
ce2481d6ce
@ -8,9 +8,9 @@ const escapeRegExp = require('escape-regexp');
|
||||
const Entities = require('html-entities').AllHtmlEntities;
|
||||
const entities = new Entities();
|
||||
|
||||
const client = require('cheerio-httpcli');
|
||||
client.referer = false;
|
||||
client.timeout = 10000;
|
||||
import * as client from 'cheerio-httpcli';
|
||||
client.set('referer', false);
|
||||
client.set('timeout', 10000);
|
||||
|
||||
import ISummary from './isummary';
|
||||
|
||||
@ -28,7 +28,7 @@ export default async (url: URL.Url): Promise<ISummary> => {
|
||||
return null;
|
||||
}
|
||||
|
||||
const $: any = res.$;
|
||||
const $: client.CheerioStaticEx = res.$;
|
||||
|
||||
let title =
|
||||
$('meta[property="og:title"]').attr('content') ||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as URL from 'url';
|
||||
|
||||
const client = require('cheerio-httpcli');
|
||||
client.referer = false;
|
||||
client.timeout = 10000;
|
||||
import * as client from 'cheerio-httpcli';
|
||||
client.set('referer', false);
|
||||
client.set('timeout', 10000);
|
||||
|
||||
export function test (url: URL.Url) {
|
||||
return url.hostname === 'www.amazon.com' ||
|
||||
@ -23,7 +23,7 @@ export function test (url: URL.Url) {
|
||||
|
||||
export async function summary (url: URL.Url) {
|
||||
const res = await client.fetch(url.href);
|
||||
const $: any = res.$;
|
||||
const $: client.CheerioStaticEx = res.$;
|
||||
|
||||
const title: string = $('#title').text();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user