fix: 修复环球律师事务所文章 (#5694)

Co-authored-by: Henry Wang <hi@henry.wang>
This commit is contained in:
Harvey Qiu 2020-09-21 19:50:26 +08:00 committed by GitHub
parent 4dc7e3e6d0
commit aeb04e2dda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -2,16 +2,16 @@ const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const url = 'http://www.glo.com.cn/news/publications_list13.html';
const url = 'http://www.glo.com.cn/insights/prespectives/';
const res = await got.get(url);
const $ = cheerio.load(res.data);
const list = $('ul.ul-list li').get();
const list = $('.news_listul li').get();
const out = await Promise.all(
list.map(async (item) => {
const $ = cheerio.load(item);
const title = $('a').attr('title');
const itemUrl = $('a').attr('href');
const title = $('a .newstit').text();
const itemUrl = 'http://www.glo.com.cn/' + $('a').attr('href');
const cache = await ctx.cache.get(itemUrl);
if (cache) {
@ -24,7 +24,7 @@ module.exports = async (ctx) => {
const single = {
title,
link: itemUrl,
description: $d('article').html(),
description: $d('.editor_con').html(),
};
ctx.cache.set(itemUrl, JSON.stringify(single));