parent
6ed47fbdf9
commit
20a7852394
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/': ['cnkmmk'],
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'lala.im': {
|
||||
_name: "荒岛",
|
||||
'.': [
|
||||
{
|
||||
title: '博客',
|
||||
docs: 'https://docs.rsshub.app/routes/blog#huang-dao',
|
||||
source: ['/'],
|
||||
target: '/lala',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/', require('./rss'));
|
||||
};
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const currentUrl = 'https://lala.im';
|
||||
const response = await got(`${currentUrl}/feed`);
|
||||
const $ = cheerio.load(response.data, { xmlMode: true });
|
||||
const titleMain = $('channel > title').text();
|
||||
const descriptionMain = $('channel > description').text();
|
||||
const items = $('channel > item')
|
||||
.map((_, item) => {
|
||||
const $item = $(item);
|
||||
const link = $item.find('link').text();
|
||||
const title = $item.find('title').text();
|
||||
const description = $item.find('description').text();
|
||||
const pubDate = $item.find('pubDate').text();
|
||||
return {
|
||||
link,
|
||||
pubDate, // no need to normalize because it's from a valid RSS feed
|
||||
title,
|
||||
description,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: titleMain,
|
||||
description: descriptionMain,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -479,3 +479,9 @@
|
|||
### 上周热门 TOP 20 {#zhu-bai-shang-zhou-re-men-top-20}
|
||||
|
||||
<Route author="nczitzk" example="/zhubai/top20" path="/zhubai/top20" radar="1" />
|
||||
|
||||
## 荒岛 {#huang-dao}
|
||||
|
||||
### 博客 {#huang-dao-bo-ke}
|
||||
|
||||
<Route author="cnkmmk" example="/lala" path="/lala" />
|
||||
Loading…
Reference in New Issue