diff --git a/docs/programming.md b/docs/programming.md
index 4f5b39997..85d117caa 100644
--- a/docs/programming.md
+++ b/docs/programming.md
@@ -564,13 +564,11 @@ GitHub 官方也提供了一些 RSS:
### 日报
-
-
+
### 近期比赛
-
-
+
## 码农俱乐部
diff --git a/lib/routes/luogu/daily.js b/lib/routes/luogu/daily.js
index eb1e2133d..4fb9ce95f 100644
--- a/lib/routes/luogu/daily.js
+++ b/lib/routes/luogu/daily.js
@@ -13,16 +13,42 @@ module.exports = async (ctx) => {
.map(function () {
const info = {
title: $(this).find('strong').text() || $(this).text(),
- description: $(this).html(),
link: $(this).find('a').attr('href'),
};
return info;
})
.get();
+ const items = await Promise.all(
+ out.map(
+ async (item) =>
+ await ctx.cache.tryGet(item.link, async () => {
+ const detailResponse = await got({
+ method: 'get',
+ url: item.link,
+ });
+ const content = cheerio.load(detailResponse.data);
+ const timeRegExp = new RegExp(/(?<=([1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\s+(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d))/);
+
+ item.description = content('#article-content').html();
+
+ content('#article-content').remove();
+
+ const line = content
+ .html()
+ .split('\n')
+ .find((line) => timeRegExp.test(line));
+
+ item.pubDate = new Date(line.match(timeRegExp)[1] + ' GMT+8').toUTCString();
+
+ return item;
+ })
+ )
+ );
+
ctx.state.data = {
title: title,
link: link,
- item: out,
+ item: items,
};
};