mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-16 02:42:57 +08:00
* #372 「ONE · 一个」RSS订阅 * 加上插画,只留当天 * 移除多余代码
This commit is contained in:
@@ -180,6 +180,7 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
|||||||
- 公告通知
|
- 公告通知
|
||||||
- 机核网
|
- 机核网
|
||||||
- 分类
|
- 分类
|
||||||
|
- ONE · 一个
|
||||||
- Mozilla
|
- Mozilla
|
||||||
- Fireofox Release Note
|
- Fireofox Release Note
|
||||||
|
|
||||||
|
|||||||
@@ -1490,6 +1490,14 @@ id, 专辑 id, 可在对应专辑页面的 URL 中找到
|
|||||||
| ---- | ---- | ---- |
|
| ---- | ---- | ---- |
|
||||||
| 1 | 2 | 9 |
|
| 1 | 2 | 9 |
|
||||||
|
|
||||||
|
## ONE · 一个
|
||||||
|
|
||||||
|
举例: [https://rsshub.app/one](https://rsshub.app/one)
|
||||||
|
|
||||||
|
路由: `/one`
|
||||||
|
|
||||||
|
参数: 无
|
||||||
|
|
||||||
## Mozilla
|
## Mozilla
|
||||||
|
|
||||||
### Firefox Release Note
|
### Firefox Release Note
|
||||||
|
|||||||
@@ -342,6 +342,9 @@ router.get('/pku/eecs/:type?', require('./routes/pku/eecs'));
|
|||||||
// 机核
|
// 机核
|
||||||
router.get('/gcores/category/:category', require('./routes/gcores/category'));
|
router.get('/gcores/category/:category', require('./routes/gcores/category'));
|
||||||
|
|
||||||
|
// 一个
|
||||||
|
router.get('/one', require('./routes/one/index'));
|
||||||
|
|
||||||
// Firefox Release Note
|
// Firefox Release Note
|
||||||
router.get('/mozilla/firefox/:platform', require('./routes/mozilla/firefox'));
|
router.get('/mozilla/firefox/:platform', require('./routes/mozilla/firefox'));
|
||||||
|
|
||||||
|
|||||||
56
routes/one/index.js
Normal file
56
routes/one/index.js
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
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://wufazhuce.com/',
|
||||||
|
headers: {
|
||||||
|
'User-Agent': config.ua,
|
||||||
|
Referer: 'http://wufazhuce.com/',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = response.data;
|
||||||
|
const $ = cheerio.load(data);
|
||||||
|
|
||||||
|
const list = [$('.item.active'), $('.corriente')[0], $('.corriente')[1]];
|
||||||
|
|
||||||
|
const out = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < list.length; i++) {
|
||||||
|
const url = $(list[i])
|
||||||
|
.find('a')
|
||||||
|
.attr('href');
|
||||||
|
const item = {
|
||||||
|
title: $(list[i])
|
||||||
|
.find('a')
|
||||||
|
.text()
|
||||||
|
.replace(/\s+/g, ' ')
|
||||||
|
.trim(),
|
||||||
|
link: url,
|
||||||
|
description: '',
|
||||||
|
};
|
||||||
|
const detail = await axios({
|
||||||
|
method: 'get',
|
||||||
|
url: url,
|
||||||
|
headers: {
|
||||||
|
'User-Agent': config.ua,
|
||||||
|
Referer: 'http://wufazhuce.com/',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
{
|
||||||
|
const data = detail.data;
|
||||||
|
const $ = cheerio.load(data);
|
||||||
|
item.description = $('.tab-content').html();
|
||||||
|
}
|
||||||
|
out.push(item);
|
||||||
|
}
|
||||||
|
ctx.state.data = {
|
||||||
|
title: $('title').text(),
|
||||||
|
link: 'http://wufazhuce.com/',
|
||||||
|
item: out,
|
||||||
|
description: '复杂世界里, 一个就够了. One is all.',
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user