@@ -148,6 +148,12 @@ username 为博主用户名,而非`xxx.hashnode.dev`中`xxx`所代表的 blog
|
||||
|
||||
<Route author="chazeon" example="/stratechery" path="/stratechery" />
|
||||
|
||||
## v1tx
|
||||
|
||||
### 最新文章
|
||||
|
||||
<Route author="TonyRL" example="/v1tx" path="/v1tx" radar="1" rssbud="1" />
|
||||
|
||||
## Whoscall
|
||||
|
||||
### 最新文章
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const baseUrl = 'https://www.v1tx.com';
|
||||
const response = await got(`${baseUrl}/wp-json/wp/v2/posts`, {
|
||||
searchParams: {
|
||||
per_page: ctx.query.limit ?? 100,
|
||||
},
|
||||
});
|
||||
|
||||
const items = response.data.map((item) => {
|
||||
const $ = cheerio.load(item.content.rendered, null, false);
|
||||
$('figure > picture > source').remove();
|
||||
$('img').each((_, img) => {
|
||||
img.attribs.src = img.attribs.src.replace(/-1024x\d+\.jpg/, '.webp').replace('.jpg', '.webp');
|
||||
delete img.attribs.srcset;
|
||||
});
|
||||
return {
|
||||
title: item.title.rendered,
|
||||
link: item.link,
|
||||
guid: item.guid.rendered,
|
||||
description: $.html(),
|
||||
pubDate: parseDate(item.date_gmt),
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'v1tx - 发现实用工具与软件',
|
||||
description: 'v1tx.com 专注于发现新应用,推荐各种效率工具、软件、APP,包括Windows、Mac、Android、iOS、网页等多平台应用,让每个人找到适合的软件并掌握使用技巧',
|
||||
link: baseUrl,
|
||||
image: `${baseUrl}/wp-content/uploads/2018/10/cropped-Favicon.webp`,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
'': ['TonyRL'],
|
||||
'/': ['TonyRL'],
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
'v1tx.com': {
|
||||
_name: 'v1tx',
|
||||
'.': [
|
||||
{
|
||||
title: '最新文章',
|
||||
docs: 'https://docs.rsshub.app/blog.html#v1tx',
|
||||
source: ['/'],
|
||||
target: '/v1tx',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/', require('./index'));
|
||||
};
|
||||
Reference in New Issue
Block a user