Fix DLU sort (#5631)
This commit is contained in:
parent
35edb3cb52
commit
459b54b752
|
|
@ -27,16 +27,19 @@ module.exports = async (ctx) => {
|
|||
|
||||
const $ = cheerio.load(iconv.decode(response.data, 'utf-8'));
|
||||
|
||||
const regex = /(\d+)\.htm/;
|
||||
|
||||
ctx.state.data = {
|
||||
link: base_url,
|
||||
title: '大连大学教务处',
|
||||
item: $('td[valign="top"]>table[cellspacing="3"][width="100%"] tr')
|
||||
.slice(0, 10)
|
||||
.map((_, elem) => ({
|
||||
link: resolve_url(base_url, $('a', elem).attr('href')),
|
||||
title: $('a', elem).attr('title'),
|
||||
pubDate: new Date(new Date().getFullYear() + '-' + $('[class*="timestyle"]', elem).text().replace('/', '-')).toUTCString(),
|
||||
}))
|
||||
.get(),
|
||||
.get()
|
||||
.sort((one, two) => two.link.match(regex)[1] - one.link.match(regex)[1])
|
||||
.slice(0, 20),
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue