forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(route): v1tx * fix: remove author
- Loading branch information
Showing
5 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
'': ['TonyRL'], | ||
'/': ['TonyRL'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
'v1tx.com': { | ||
_name: 'v1tx', | ||
'.': [ | ||
{ | ||
title: '最新文章', | ||
docs: 'https://docs.rsshub.app/blog.html#v1tx', | ||
source: ['/'], | ||
target: '/v1tx', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = (router) => { | ||
router.get('/', require('./index')); | ||
}; |