fix: 游研社路由故障 #6156 (#6157)

This commit is contained in:
Laam Pui 2020-11-13 01:52:22 +08:00 committed by GitHub
parent 3854cacc7b
commit 423c53ae5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 50 deletions

View File

@ -26,14 +26,14 @@ module.exports = async (ctx) => {
})
.get();
const second_part = $('.b-list li')
const second_part = $('.list-container li')
.slice(0, 18)
.map(function () {
const info = {
title: $(this).find('.b-item-title').text(),
link: 'http://www.yystv.cn' + $(this).find('.b-item-title a').attr('href'),
pubDate: date($(this).find('.fl').text()),
author: $(this).find('.author-icon-list').text(),
title: $('.list-article-title', this).text(),
link: 'http://www.yystv.cn' + $('a', this).attr('href'),
pubDate: date($('.c-999', this).text()),
author: $('.handler-author-link', this).text(),
};
return info;
})

View File

@ -1,45 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const date = require('@/utils/date');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'http://www.yystv.cn/b/recommend',
});
const data = response.data;
const $ = cheerio.load(data);
const first_part = $('.b-list-main-item')
.slice(0, 2)
.map(function () {
const info = {
title: $(this).find('.b-main-info-title').text(),
link: 'http://www.yystv.cn' + $(this).find('.b-main-info-title a').attr('href'),
pubDate: date($(this).find('.b-main-createtime').text()),
author: $(this).find('.b-author').text(),
};
return info;
})
.get();
const second_part = $('.b-list li')
.slice(0, 8)
.map(function () {
const info = {
title: $(this).find('.b-item-title').text(),
link: 'http://www.yystv.cn' + $(this).find('.b-item-title a').attr('href'),
pubDate: date($(this).find('.fl').text()),
author: $(this).find('.author-icon-list').text(),
};
return info;
})
.get();
ctx.state.data = {
title: '游研社-推游',
link: 'http://www.yystv.cn/b/recommend',
item: first_part.concat(second_part),
};
};