style: auto format
This commit is contained in:
+16
-18
@@ -2,33 +2,31 @@ const { parseDate } = require('@/utils/parse-date');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'https://www.zrblog.net/';
|
||||
const response = await got({ method: 'get', url });
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = $("div.art_img_box")
|
||||
.map((i, e) => {
|
||||
const element = $(e);
|
||||
const title = element.find('h2 > a').attr('title');
|
||||
const link = element.find('h2 > a').attr('href');
|
||||
const description = element.find('p.intro').text();
|
||||
const dateraw = element.find("div.info").find('span').eq(0).text();
|
||||
|
||||
return {
|
||||
title,
|
||||
description,
|
||||
link,
|
||||
pubDate: parseDate(dateraw, '发布日期:YYYY年MM月DD日'),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
const list = $('div.art_img_box')
|
||||
.map((i, e) => {
|
||||
const element = $(e);
|
||||
const title = element.find('h2 > a').attr('title');
|
||||
const link = element.find('h2 > a').attr('href');
|
||||
const description = element.find('p.intro').text();
|
||||
const dateraw = element.find('div.info').find('span').eq(0).text();
|
||||
|
||||
return {
|
||||
title,
|
||||
description,
|
||||
link,
|
||||
pubDate: parseDate(dateraw, '发布日期:YYYY年MM月DD日'),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: '赵容部落',
|
||||
link: url,
|
||||
item: list,
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -460,6 +460,12 @@
|
||||
|
||||
<Route author="aneasystone" example="/cloudnative/blog" path="/cloudnative/blog" />
|
||||
|
||||
## 赵容部落 {#zhao-rong-bu-luo}
|
||||
|
||||
### 博客 {#zhao-rong-bu-luo-bo-ke}
|
||||
|
||||
<Route author="cnkmmk" example="/zrblog" path="/zrblog" />
|
||||
|
||||
## 浙江大学可视分析小组 {#zhe-jiang-da-xue-ke-shi-fen-xi-xiao-zu}
|
||||
|
||||
### 博客 {#zhe-jiang-da-xue-ke-shi-fen-xi-xiao-zu-bo-ke}
|
||||
@@ -485,9 +491,3 @@
|
||||
### 上周热门 TOP 20 {#zhu-bai-shang-zhou-re-men-top-20}
|
||||
|
||||
<Route author="nczitzk" example="/zhubai/top20" path="/zhubai/top20" radar="1" />
|
||||
|
||||
## 赵容部落 {#zhao-rong-bu-luo}
|
||||
|
||||
### 博客 {#zhao-rong-bu-luo-bo-ke}
|
||||
|
||||
<Route author="cnkmmk" example="/zrblog" path="/zrblog" />
|
||||
Reference in New Issue
Block a user