fix: 龙腾网无内容 (#2054)

This commit is contained in:
kimi360
2019-05-07 01:10:05 +08:00
committed by DIYgod
parent a8066bdf35
commit 9631dcfae5
2 changed files with 2 additions and 3 deletions

View File

@@ -1,6 +1,5 @@
const axios = require('../../utils/axios'); // get web content const axios = require('../../utils/axios'); // get web content
const cheerio = require('cheerio'); // html parser const cheerio = require('cheerio'); // html parser
const iconv = require('iconv-lite');
const domain = 'http://www.ltaaa.com'; const domain = 'http://www.ltaaa.com';
@@ -15,7 +14,7 @@ module.exports = async function get_article(url) {
responseType: 'arraybuffer', responseType: 'arraybuffer',
}); });
const data = response.data; const data = response.data;
const $ = cheerio.load(iconv.decode(data, 'CP936')); const $ = cheerio.load(data);
const title = $('div.post-title > strong').text(); const title = $('div.post-title > strong').text();
const author = $('div.post-param > a').text(); const author = $('div.post-param > a').text();

View File

@@ -38,7 +38,7 @@ module.exports = async (ctx) => {
let a = $(target).find('a.rtitle'); let a = $(target).find('a.rtitle');
if (!a || a.length <= 0) { if (!a || a.length <= 0) {
a = $(target).find('div.dtop > a'); a = $(target).find('div.li-title > a');
} }
for (let i = 0; i < a.length; ++i) { for (let i = 0; i < a.length; ++i) {