mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 23:00:48 +08:00
feat: add 优设网优设读报 (#6195)
This commit is contained in:
@@ -140,6 +140,10 @@ Behance 用户主页 URL 获取用户名,如 <https://www.behance.net/mishapet
|
||||
|
||||
</Route>
|
||||
|
||||
### 优设读报
|
||||
|
||||
<Route author="nczitzk" example="/uisdc/news" path="/uisdc/news"/>
|
||||
|
||||
## 站酷
|
||||
|
||||
### 推荐
|
||||
|
||||
@@ -3503,6 +3503,7 @@ router.get('/jiazhen108', require('./routes/jiazhen108/index'));
|
||||
router.get('/instagram/:category/:key', require('./routes/instagram/index'));
|
||||
|
||||
// 优设网
|
||||
router.get('/uisdc/news', require('./routes/uisdc/news'));
|
||||
router.get('/uisdc/zt/:title?', require('./routes/uisdc/zt'));
|
||||
router.get('/uisdc/topic/:title?/:sort?', require('./routes/uisdc/topic'));
|
||||
|
||||
|
||||
34
lib/routes/uisdc/news.js
Normal file
34
lib/routes/uisdc/news.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://www.uisdc.com/news';
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: rootUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
$('.num').remove();
|
||||
|
||||
const items = $('.oneimg')
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
const description = item.find('.item-content').html();
|
||||
const date = description.match(/db-(\d{8})-\d{1}.jpg/)[1];
|
||||
return {
|
||||
description,
|
||||
link: rootUrl,
|
||||
title: item.find('h3').text(),
|
||||
pubDate: new Date(`${date.substr(0, 4)}-${date.substr(4, 2)}-${date.substr(6, 2)}`).toUTCString(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: rootUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user