mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 07:12:51 +08:00
feat: Add 绝对领域 (#4338)
This commit is contained in:
@@ -179,6 +179,14 @@ pageClass: routes
|
|||||||
| ------ | ---------- |
|
| ------ | ---------- |
|
||||||
| ooxx | top-ooxx |
|
| ooxx | top-ooxx |
|
||||||
|
|
||||||
|
## 绝对领域
|
||||||
|
|
||||||
|
<Route author="Kherrisan" example="/jdlingyu/tuji" path="/jdlingyu/:type" :paramsDesc="['分区名']"/>
|
||||||
|
|
||||||
|
| 图集 | 文章 |
|
||||||
|
| ---- | ---- |
|
||||||
|
| tuji | as |
|
||||||
|
|
||||||
## 妹子图
|
## 妹子图
|
||||||
|
|
||||||
### 首页(最新)
|
### 首页(最新)
|
||||||
|
|||||||
@@ -2496,6 +2496,9 @@ router.get('/checkra1n/releases', require('./routes/checkra1n/releases'));
|
|||||||
// 四川省科学技术厅
|
// 四川省科学技术厅
|
||||||
router.get('/sckjt/news/:type?', require('./routes/sckjt/news'));
|
router.get('/sckjt/news/:type?', require('./routes/sckjt/news'));
|
||||||
|
|
||||||
|
// 绝对领域
|
||||||
|
router.get('/jdlingyu/:type', require('./routes/jdlingyu/index'));
|
||||||
|
|
||||||
// Hi, DIYgod
|
// Hi, DIYgod
|
||||||
router.get('/blogs/diygod/animal-crossing', require('./routes/blogs/diygod/animal-crossing'));
|
router.get('/blogs/diygod/animal-crossing', require('./routes/blogs/diygod/animal-crossing'));
|
||||||
router.get('/blogs/diygod/gk', require('./routes/blogs/diygod/gk'));
|
router.get('/blogs/diygod/gk', require('./routes/blogs/diygod/gk'));
|
||||||
|
|||||||
51
lib/routes/jdlingyu/index.js
Normal file
51
lib/routes/jdlingyu/index.js
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
const baseUrl = 'https://www.jdlingyu.mobi/';
|
||||||
|
const viewProps = {
|
||||||
|
tuji: '图集',
|
||||||
|
as: '文章',
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const type = ctx.params.type || 'tuji';
|
||||||
|
const url = baseUrl + type;
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: url,
|
||||||
|
});
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
|
||||||
|
const items = await Promise.all(
|
||||||
|
$('#main > div.grid-bor > div')
|
||||||
|
.get()
|
||||||
|
.map(async (div) => {
|
||||||
|
const a = $(div).find('.entry-title > a');
|
||||||
|
const link = a.attr('href');
|
||||||
|
const description = await ctx.cache.tryGet(link, async () => {
|
||||||
|
const response = await got.get(link);
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
return $('#content-innerText > p').html();
|
||||||
|
});
|
||||||
|
return Promise.resolve({
|
||||||
|
title: a.text(),
|
||||||
|
description: description,
|
||||||
|
author: $(div)
|
||||||
|
.find('.post-header .users')
|
||||||
|
.text(),
|
||||||
|
link: link,
|
||||||
|
pubDate: new Date(
|
||||||
|
$(div)
|
||||||
|
.find('.post-header time')
|
||||||
|
.attr('datetime')
|
||||||
|
).toUTCString(),
|
||||||
|
});
|
||||||
|
})
|
||||||
|
);
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${viewProps[type]} - 绝对领域`,
|
||||||
|
link: url,
|
||||||
|
description: `${viewProps[type]} - 绝对领域`,
|
||||||
|
item: items,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user