mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat(route): recover gofans (#14183)
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
const { join } = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { kind = '' } = ctx.params;
|
||||
const baseUrl = 'https://gofans.cn';
|
||||
|
||||
const { data: response } = await got('https://api.gofans.cn/v1/web/app_records', {
|
||||
headers: {
|
||||
origin: baseUrl,
|
||||
},
|
||||
searchParams: {
|
||||
limit: 20,
|
||||
kind: kind && (kind === 'macos' ? 1 : 2),
|
||||
page: 1,
|
||||
},
|
||||
});
|
||||
|
||||
const items = response.data.map((item) => ({
|
||||
title: `「${item.price === '0.00' ? '免费' : '降价'}」-「${item.kind === 1 ? 'macOS' : 'iOS'}」${item.name}`,
|
||||
description: art(join(__dirname, 'templates/description.art'), {
|
||||
icon: item.icon,
|
||||
originalPrice: item.original_price,
|
||||
price: item.price,
|
||||
kind: item.kind,
|
||||
description: item.description.replaceAll('\n', '<br>'),
|
||||
}),
|
||||
pubDate: parseDate(item.updated_at, 'X'),
|
||||
link: new URL(`/app/${item.uuid}`, baseUrl).href,
|
||||
category: item.primary_genre_name,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: '最新限免 / 促销应用',
|
||||
link: baseUrl,
|
||||
description: 'GoFans:最新限免 / 促销应用',
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/:kind?': ['HenryQW'],
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
'gofans.cn': {
|
||||
_name: 'GoFans',
|
||||
'.': [
|
||||
{
|
||||
title: '最新限免 / 促销应用',
|
||||
docs: 'https://docs.rsshub.app/program-update#gofans',
|
||||
source: ['/limited/:kind?', '/'],
|
||||
target: (params) => `/gofans${(params.kind && (params.kind === 'macos' ? '/macos' : '/ios')) || ''}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/:kind?', require('./index'));
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
<img src="{{ icon }}">
|
||||
<br>
|
||||
原价:¥{{ originalPrice }} -> 现价:¥{{ price }}
|
||||
<br>
|
||||
平台:{{ kind === 1 ? 'macOS' : 'iOS' }}
|
||||
<br/>
|
||||
{{@ description }}
|
||||
@@ -266,6 +266,12 @@ Need to configure `CIVITAI_COOKIE` to obtain image information of NSFW models.
|
||||
|
||||
<Route author="nczitzk" example="/fosshub/qBittorrent" path="/fosshub/:id" paramsDesc={['Software id, can be found in URL']} />
|
||||
|
||||
## GoFans {#gofans}
|
||||
|
||||
### 最新限免 / 促销应用 {#gofans-zui-xin-xian-mian-cu-xiao-ying-yong}
|
||||
|
||||
<Route author="HenryQW" example="/gofans" path="/gofans/:kind?" paramsDesc={['Platform, either `macos` or `ios`, empty means both (default)']} radar="1" />
|
||||
|
||||
## Greasy Fork {#greasy-fork}
|
||||
|
||||
### Script Update {#greasy-fork-script-update}
|
||||
|
||||
Reference in New Issue
Block a user