mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: add fields medal (#6467)
This commit is contained in:
@@ -158,6 +158,12 @@ Provides a better reading experience (full text articles) over the official one.
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## International Mathematical Union
|
||||
|
||||
### Fields Medal
|
||||
|
||||
<RouteEn author="nczitzk" example="/mathunion/fields-medal" path="/mathunion/fields-medal"/>
|
||||
|
||||
## Letterboxd
|
||||
|
||||
### User diary
|
||||
|
||||
@@ -1033,6 +1033,12 @@ others = 热点新闻 + 滚动新闻
|
||||
|
||||
</Route>
|
||||
|
||||
## 国际数学联合会
|
||||
|
||||
### 菲尔兹奖
|
||||
|
||||
<Route author="nczitzk" example="/mathunion/fields-medal" path="/mathunion/fields-medal"/>
|
||||
|
||||
## 果壳网
|
||||
|
||||
### 科学人
|
||||
|
||||
@@ -3718,6 +3718,9 @@ router.get('/interesting-sky/astronomical_events/:year?', require('./routes/inte
|
||||
router.get('/interesting-sky/recent-interesting', require('./routes/interesting-sky/recent-interesting'));
|
||||
router.get('/interesting-sky', require('./routes/interesting-sky/index'));
|
||||
|
||||
// 国际数学联合会
|
||||
router.get('/mathunion/fields-medal', require('./routes/mathunion/fields-medal'));
|
||||
|
||||
// ACM
|
||||
router.get('/acm/amturingaward', require('./routes/acm/amturingaward'));
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://www.mathunion.org';
|
||||
const currentUrl = `${rootUrl}/imu-awards/fields-medal`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const items = $('div.main-section')
|
||||
.eq(2)
|
||||
.find('.list__group')
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
const year = item.find('h3').text();
|
||||
const detailUrl = item.find('ul li a').attr('href');
|
||||
|
||||
item.find('h3, ul').remove();
|
||||
|
||||
return {
|
||||
title: year,
|
||||
link: detailUrl || currentUrl,
|
||||
description: `<ul>${item.html()}</ul>`,
|
||||
pubDate: new Date(`${year}-12-31`).toUTCString(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user