Add(route): add: 雨苁安全博客 (#8884)
This commit is contained in:
parent
ae051c95cf
commit
89d2a6e294
10
docs/blog.md
10
docs/blog.md
|
|
@ -211,3 +211,13 @@ pageClass: routes
|
|||
### 文章
|
||||
|
||||
<Route author="junbaor SkiTiSu" example="/blogs/wangyin" path="/blogs/wangyin"/>
|
||||
|
||||
## 雨苁博客
|
||||
|
||||
### 首页
|
||||
|
||||
<Route author="XinRoom" example="/ddosi" path="/ddosi"/>
|
||||
|
||||
### 分类
|
||||
|
||||
<Route author="XinRoom" example="/ddosi/category/黑客工具" path="/ddosi/category/:category?"/>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
const envs = process.env;
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'https://www.ddosi.org/category';
|
||||
const userAgent = envs.UA || 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1';
|
||||
const category = ctx.params.category;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `${url}/${category}/`,
|
||||
headers: {
|
||||
'User-Agent': userAgent,
|
||||
Referer: url,
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('main>article').get();
|
||||
|
||||
const items = list.map((i) => {
|
||||
const item = $(i);
|
||||
|
||||
const href = item.find('a:first-child').attr('href');
|
||||
const title = item.find('.entry-title a').text();
|
||||
const description = item.find('.entry-content p').text();
|
||||
const date = parseDate(item.find('.meta-date a time').attr('datetime'));
|
||||
|
||||
return {
|
||||
title: String(title),
|
||||
description: String(description),
|
||||
pubDate: date,
|
||||
link: String(href),
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: `雨苁-${category}`,
|
||||
link: `${url}/${category}/`,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
const envs = process.env;
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'https://www.ddosi.org/';
|
||||
const userAgent = envs.UA || 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1';
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: String(url),
|
||||
headers: {
|
||||
'User-Agent': userAgent,
|
||||
Referer: url,
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('main>article').get();
|
||||
|
||||
const items = list.map((i) => {
|
||||
const item = $(i);
|
||||
|
||||
const href = item.find('a:first-child').attr('href');
|
||||
const title = item.find('.entry-title a').text();
|
||||
const description = item.find('.entry-content p').text();
|
||||
const date = parseDate(item.find('.meta-date a time').attr('datetime'));
|
||||
|
||||
return {
|
||||
title: String(title),
|
||||
description: String(description),
|
||||
pubDate: date,
|
||||
link: String(href),
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: `雨苁`,
|
||||
link: String(url),
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
'/': ['XinRoom'],
|
||||
'/category/:category': ['XinRoom'],
|
||||
};
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
module.exports = {
|
||||
'www.ddosi.org': {
|
||||
_name: '🔰雨苁ℒ🔰',
|
||||
'.': [
|
||||
{
|
||||
title: '首页',
|
||||
docs: 'https://docs.rsshub.app/blog.html#yu-cong-bo-ke-shou-ye',
|
||||
source: ['/'],
|
||||
target: '/ddosi/',
|
||||
},
|
||||
{
|
||||
title: '分类',
|
||||
docs: 'https://docs.rsshub.app/blog.html#yu-cong-bo-ke-fen-lei',
|
||||
source: ['/category/:category/'],
|
||||
target: '/ddosi/category/:category',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/category/:category?', require('./category'));
|
||||
router.get('/', require('./index'));
|
||||
};
|
||||
Loading…
Reference in New Issue