feat(route): pen0 (#11427)
This commit is contained in:
@@ -290,18 +290,6 @@ username 为博主用户名,而非`xxx.hashnode.dev`中`xxx`所代表的 blog
|
||||
|
||||
<Route author="a180285" example="/blogs/jingwei.link" path="/blogs/jingwei.link"/>
|
||||
|
||||
## 零博客
|
||||
|
||||
### 分类
|
||||
|
||||
<Route author="nczitzk" example="/agora0/initium" path="/agora0/:category?" :paramsDesc="['分类,见下表,默认为 initium,即端传媒']">
|
||||
|
||||
| muitinⒾ | aidemnⒾ | srettaⓂ | qⓅ | sucoⓋ |
|
||||
| ------- | ------- | ------- | -- | ----- |
|
||||
| initium | inmedia | matters | pq | vocus |
|
||||
|
||||
</Route>
|
||||
|
||||
## 每日安全
|
||||
|
||||
### 推送
|
||||
|
||||
@@ -151,6 +151,22 @@ pageClass: routes
|
||||
|
||||
</Route>
|
||||
|
||||
## AG⓪RA
|
||||
|
||||
### 零博客
|
||||
|
||||
<Route author="nczitzk" example="/agora0/initium" path="/agora0/:category?" :paramsDesc="['分类,见下表,默认为 initium,即端传媒']" radar="1" rssbud="1">
|
||||
|
||||
| muitinⒾ | aidemnⒾ | srettaⓂ | qⓅ | sucoⓋ |
|
||||
| ------- | ------- | ------- | -- | ----- |
|
||||
| initium | inmedia | matters | pq | vocus |
|
||||
|
||||
</Route>
|
||||
|
||||
### 共和報
|
||||
|
||||
<Route author="TonyRL" example="/agora0/pen0" path="/agora0/pen0" radar="1" rssbud="1"/>
|
||||
|
||||
## AppleInsider
|
||||
|
||||
### 分类
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
module.exports = {
|
||||
'/pen0': ['TonyRL'],
|
||||
'/:category?': ['nczitzk'],
|
||||
};
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const baseUrl = 'https://agorahub.github.io';
|
||||
const response = await got(`${baseUrl}/pen0/`);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = $('div article')
|
||||
.toArray()
|
||||
.slice(0, -1) // last one is a dummy
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
const meta = item.find('h5').first().text();
|
||||
return {
|
||||
title: item.find('h3').text(),
|
||||
link: item.find('h3 a').attr('href'),
|
||||
author: meta.split('|')[0].trim(),
|
||||
pubDate: parseDate(meta.split('|')[1].trim()),
|
||||
};
|
||||
});
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const response = await got(item.link);
|
||||
const $ = cheerio.load(response.data);
|
||||
$('h1').remove();
|
||||
item.description = $('article').html();
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('head title').text(),
|
||||
description: $('head meta[name="description"]').attr('content'),
|
||||
link: response.url,
|
||||
image: $('link[rel="apple-touch-icon"]').attr('href'),
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
+12
-1
@@ -1,10 +1,21 @@
|
||||
module.exports = {
|
||||
'github.io': {
|
||||
_name: 'GitHub',
|
||||
agorahub: [
|
||||
{
|
||||
title: '共和報',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#ag0ra',
|
||||
source: ['/pen0'],
|
||||
target: '/agora0/pen0',
|
||||
},
|
||||
],
|
||||
},
|
||||
'gitlab.io': {
|
||||
_name: 'GitLab',
|
||||
agora0: [
|
||||
{
|
||||
title: '零博客',
|
||||
docs: 'https://docs.rsshub.app/blog.html#ling-bo-ke-fen-lei',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#ag0ra',
|
||||
source: ['/blog/:category', '/'],
|
||||
target: '/agora0/:category',
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/pen0', require('./pen0'));
|
||||
router.get('/:category?', require('./index'));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user