fix: matters item (#3929)

This commit is contained in:
hoilc
2020-02-09 19:38:52 +08:00
committed by GitHub
parent 9ce3ead6f3
commit 986aba9eba
3 changed files with 9 additions and 15 deletions

View File

@@ -6,7 +6,7 @@ module.exports = async (ctx) => {
const res = await got.get(url);
const $ = cheerio.load(res.data);
const list = $('li section.container').get();
const list = $('section.list-item').get();
const proList = [];
const indexList = [];
@@ -16,10 +16,8 @@ module.exports = async (ctx) => {
const $ = cheerio.load(item);
const time = $('time').attr('datetime');
const title = $('h2').text();
const author = $('div.content a')
.attr('href')
.replace(/\/@(.*?)\/.*/, '$1');
const postfix = encodeURI($('div.content a').attr('href'));
const author = $('span.displayname').text();
const postfix = encodeURI($('section.title > 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 got.get(url);
const $ = cheerio.load(res.data);
const list = $('article li section.container').get();
const list = $('article section.list-item').get();
const proList = [];
const indexList = [];
@@ -16,10 +16,8 @@ module.exports = async (ctx) => {
const $ = cheerio.load(item);
const time = $('time').attr('datetime');
const title = $('h2').text();
const author = $('div.content a')
.attr('href')
.replace(/\/@(.*?)\/.*/, '$1');
const partial = encodeURI($('div.content a').attr('href'));
const author = $('span.displayname').text();
const partial = encodeURI($('section.title > 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 got.get(url);
const $ = cheerio.load(res.data);
const list = $('li section.container').get();
const list = $('section.list-item').get();
const proList = [];
const indexList = [];
@@ -16,10 +16,8 @@ module.exports = async (ctx) => {
const $ = cheerio.load(item);
const time = $('time').attr('datetime');
const title = $('h2').text();
const author = $('div.content a')
.attr('href')
.replace(/\/@(.*?)\/.*/, '$1');
const postfix = encodeURI($('div.content a').attr('href'));
const author = $('span.displayname').text();
const postfix = encodeURI($('section.title > a').attr('href'));
const address = `https://matters.news${postfix}`;
const cache = await ctx.cache.get(address);
if (cache) {