This commit is contained in:
maijver 2021-01-09 12:17:17 +08:00
parent f8e181a8b0
commit 998c8b14af
1 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@ const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const rootUrl = 'https://m.allnow.com';
const rootUrl = 'https://www.allnow.com';
const currentUrl = `${rootUrl}/column/${ctx.params.id}`;
const response = await got({
method: 'get',
@ -10,7 +10,7 @@ module.exports = async (ctx) => {
});
const $ = cheerio.load(response.data);
const list = $('a.normal')
const list = $('.post-list .post')
.slice(0, 10)
.map((_, item) => {
item = $(item);
@ -33,7 +33,7 @@ module.exports = async (ctx) => {
item.title = content('p.title').text();
item.author = content('a.single-name').eq(0).text();
item.description = content('#article-content').html();
item.pubDate = new Date(detailResponse.data.match(/time:"(.*)",abstract:"/)[1] + ' GMT+8').toUTCString();
item.pubDate = new Date(detailResponse.data.match(/time:"(.*?)"\}/)[1] + ' GMT+8').toUTCString();
return item;
})