feat(route): v1tx (#12034)

* feat(route): v1tx

* fix: remove author
This commit is contained in:
Tony
2023-03-04 01:28:25 +08:00
committed by GitHub
parent 7e28a20aac
commit 1726af27c0
5 changed files with 62 additions and 0 deletions
+6
View File
@@ -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
### 最新文章
+36
View File
@@ -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,
};
};
+4
View File
@@ -0,0 +1,4 @@
module.exports = {
'': ['TonyRL'],
'/': ['TonyRL'],
};
+13
View File
@@ -0,0 +1,13 @@
module.exports = {
'v1tx.com': {
_name: 'v1tx',
'.': [
{
title: '最新文章',
docs: 'https://docs.rsshub.app/blog.html#v1tx',
source: ['/'],
target: '/v1tx',
},
],
},
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/', require('./index'));
};