diff --git a/docs/en/new-media.md b/docs/en/new-media.md index 5bc4f8a0d4..713b6e4958 100644 --- a/docs/en/new-media.md +++ b/docs/en/new-media.md @@ -158,6 +158,12 @@ Provides a better reading experience (full text articles) over the official one. +## International Mathematical Union + +### Fields Medal + + + ## Letterboxd ### User diary diff --git a/docs/new-media.md b/docs/new-media.md index 6425576b3e..f0bec4aac3 100644 --- a/docs/new-media.md +++ b/docs/new-media.md @@ -1033,6 +1033,12 @@ others = 热点新闻 + 滚动新闻 +## 国际数学联合会 + +### 菲尔兹奖 + + + ## 果壳网 ### 科学人 diff --git a/lib/router.js b/lib/router.js index e937252454..76e74ef7fb 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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')); diff --git a/lib/routes/mathunion/fields-medal.js b/lib/routes/mathunion/fields-medal.js new file mode 100644 index 0000000000..e019065d98 --- /dev/null +++ b/lib/routes/mathunion/fields-medal.js @@ -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: ``, + pubDate: new Date(`${year}-12-31`).toUTCString(), + }; + }) + .get(); + + ctx.state.data = { + title: $('title').text(), + link: currentUrl, + item: items, + }; +};