fix: Github trending (#2380)

This commit is contained in:
tgly307
2019-06-12 11:16:30 +08:00
committed by DIYgod
parent fda0b82a88
commit 9565774cfe

View File

@@ -17,7 +17,7 @@ module.exports = async (ctx) => {
const data = response.data;
const $ = cheerio.load(data);
const list = $('.repo-list li');
const list = $('article');
ctx.state.data = {
title: $('title').text(),
@@ -28,8 +28,8 @@ module.exports = async (ctx) => {
.map((index, item) => {
item = $(item);
return {
title: item.find('h3').text(),
description: `${item.find('.py-1').text()}<br>
title: item.find('h1').text(),
description: `${item.find('.pr-4').text()}<br>
<br>Language: ${item.find('span[itemprop="programmingLanguage"]').text() || 'unknown'}
<br>Star: ${item
.find('.muted-link')
@@ -39,7 +39,7 @@ module.exports = async (ctx) => {
.find('.muted-link')
.eq(1)
.text()}`,
link: `https://github.com${item.find('h3 a').attr('href')}`,
link: `https://github.com${item.find('h1 a').attr('href')}`,
};
})
.get(),