Merge pull request #20 from armchair-philosophy/update_cheerio-httpcli

follow cheerio-httpcli update
This commit is contained in:
syuilo⭐️ 2017-02-05 08:37:08 +09:00 committed by GitHub
commit ce2481d6ce
2 changed files with 8 additions and 8 deletions

View File

@ -8,9 +8,9 @@ const escapeRegExp = require('escape-regexp');
const Entities = require('html-entities').AllHtmlEntities; const Entities = require('html-entities').AllHtmlEntities;
const entities = new Entities(); const entities = new Entities();
const client = require('cheerio-httpcli'); import * as client from 'cheerio-httpcli';
client.referer = false; client.set('referer', false);
client.timeout = 10000; client.set('timeout', 10000);
import ISummary from './isummary'; import ISummary from './isummary';
@ -28,7 +28,7 @@ export default async (url: URL.Url): Promise<ISummary> => {
return null; return null;
} }
const $: any = res.$; const $: client.CheerioStaticEx = res.$;
let title = let title =
$('meta[property="og:title"]').attr('content') || $('meta[property="og:title"]').attr('content') ||

View File

@ -1,8 +1,8 @@
import * as URL from 'url'; import * as URL from 'url';
const client = require('cheerio-httpcli'); import * as client from 'cheerio-httpcli';
client.referer = false; client.set('referer', false);
client.timeout = 10000; client.set('timeout', 10000);
export function test (url: URL.Url) { export function test (url: URL.Url) {
return url.hostname === 'www.amazon.com' || return url.hostname === 'www.amazon.com' ||
@ -23,7 +23,7 @@ export function test (url: URL.Url) {
export async function summary (url: URL.Url) { export async function summary (url: URL.Url) {
const res = await client.fetch(url.href); const res = await client.fetch(url.href);
const $: any = res.$; const $: client.CheerioStaticEx = res.$;
const title: string = $('#title').text(); const title: string = $('#title').text();