fix: matters解析失败 (#2272)

* fix: matters解析失败

* 修改选择器
This commit is contained in:
Chenyang Shi 2019-06-02 12:38:43 +08:00 committed by DIYgod
parent 426450d7ec
commit fbb7fa321e
4 changed files with 8 additions and 8 deletions

View File

@ -6,7 +6,7 @@ module.exports = async (ctx) => {
const res = await axios.get(url);
const $ = cheerio.load(res.data);
const list = $('section.jsx-1110843272.container').get();
const list = $('li section.container').get();
const proList = [];
const indexList = [];
@ -16,7 +16,7 @@ module.exports = async (ctx) => {
const $ = cheerio.load(item);
const time = $('time').attr('datetime');
const title = $('h2').text();
const postfix = encodeURI($('a.jsx-1110843272').attr('href'));
const postfix = encodeURI($('div.content a').attr('href'));
const address = `https://matters.news${postfix}`;
const cache = await ctx.cache.get(address);
if (cache) {

View File

@ -6,7 +6,7 @@ module.exports = async (ctx) => {
const res = await axios.get(url);
const $ = cheerio.load(res.data);
const list = $('section.jsx-1110843272.container').get();
const list = $('article li section.container').get();
const proList = [];
const indexList = [];
@ -16,7 +16,7 @@ module.exports = async (ctx) => {
const $ = cheerio.load(item);
const time = $('time').attr('datetime');
const title = $('h2').text();
const partial = encodeURI($('a.jsx-1110843272').attr('href'));
const partial = encodeURI($('div.content a').attr('href'));
const completeUrl = `https://matters.news${partial}`;
const cache = await ctx.cache.get(completeUrl);
if (cache) {

View File

@ -6,7 +6,7 @@ module.exports = async (ctx) => {
const res = await axios.get(url);
const $ = cheerio.load(res.data);
const list = $('section.jsx-1110843272.container').get();
const list = $('li section.container').get();
const proList = [];
const indexList = [];
@ -16,7 +16,7 @@ module.exports = async (ctx) => {
const $ = cheerio.load(item);
const time = $('time').attr('datetime');
const title = $('h2').text();
const postfix = encodeURI($('a.jsx-1110843272').attr('href'));
const postfix = encodeURI($('div.content a').attr('href'));
const address = `https://matters.news${postfix}`;
const cache = await ctx.cache.get(address);
if (cache) {

View File

@ -6,7 +6,7 @@ module.exports = async (ctx) => {
const res = await axios.get(url);
const $ = cheerio.load(res.data);
const list = $('section.jsx-1110843272.container').get();
const list = $('li section.container').get();
const proList = [];
const indexList = [];
@ -16,7 +16,7 @@ module.exports = async (ctx) => {
const $ = cheerio.load(item);
const time = $('time').attr('datetime');
const title = $('h2').text();
const postfix = encodeURI($('a.jsx-1110843272').attr('href'));
const postfix = encodeURI($('div.content a').attr('href'));
const address = `https://matters.news${postfix}`;
const cache = await ctx.cache.get(address);
if (cache) {