mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-15 18:30:53 +08:00
添加科技星球首页更新 (#344)
This commit is contained in:
@@ -172,6 +172,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
||||
- 标签
|
||||
- 草榴
|
||||
- 分区帖子
|
||||
- 科技星球
|
||||
- 首页
|
||||
|
||||
## 鸣谢
|
||||
|
||||
|
||||
@@ -1419,3 +1419,11 @@ id, 专辑 id, 可在对应专辑页面的 URL 中找到
|
||||
| 技术讨论区 | 新时代的我们 | 达盖尔的旗帜 |
|
||||
| ---------- | ------------ | ------------ |
|
||||
| 7 | 8 | 16 |
|
||||
|
||||
## 科技星球
|
||||
|
||||
### 首页
|
||||
|
||||
举例: [https://rsshub.app/kejixingqiu/home](https://rsshub.app/kejixingqiu/home)
|
||||
|
||||
路由: `/kejixingqiu/home`
|
||||
@@ -331,4 +331,7 @@ router.get('/cctv/:category', require('./routes/cctv/category'));
|
||||
// 草榴社区
|
||||
router.get('/t66y/:id', require('./routes/t66y/index'));
|
||||
|
||||
// 科技星球
|
||||
router.get('/kejixingqiu/home', require('./routes/kejixingqiu/home'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
39
routes/kejixingqiu/home.js
Normal file
39
routes/kejixingqiu/home.js
Normal file
@@ -0,0 +1,39 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: 'http://www.xincheng.tv',
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.l-news_item');
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: 'http://www.xincheng.tv',
|
||||
description: $('meta[name="description"]').attr('content'),
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: `${item.find('.sub1-titile2').text()} - ${item.find('.sub1-titile1').text()}`,
|
||||
description: item.find('.sub1-new-item').text(),
|
||||
link: `http://www.xincheng.tv${item
|
||||
.find('.sub1-titile2')
|
||||
.parent()
|
||||
.attr('href')}`,
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user