feat(route): add appstare (#17348)

* 新增appstare

* 完善

* fix: typo

---------

Co-authored-by: 张凯龙 <zhangkailong@192.168.0.3>
This commit is contained in:
窒息得鱼 2024-10-30 11:46:22 +08:00 committed by GitHub
parent 755686c4b6
commit 58cce2282d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,57 @@
import { Route } from '@/types';
import ofetch from '@/utils/ofetch';
export const handler = async (ctx) => {
const country = ctx.req.param('country');
const appid = ctx.req.param('appid');
const url = `https://monitor.appstare.net/spider/appComments?country=${country}&appId=${appid}`;
const data = await ofetch(url);
const items = data.map((item) => ({
title: item.title,
description: `
<div style="font-size: 1.2em; color: #FFD700;">${'⭐️'.repeat(Math.floor(item.rating))}</div>
<p>${item.review}</p>
`,
pubDate: new Date(item.date).toUTCString(),
}));
const link = `https://appstare.net/data/app/comment/${appid}/${country}`;
return {
title: 'App Comments',
appID: appid,
country,
item: items,
link,
allowEmpty: true,
};
};
export const route: Route = {
path: '/comments/:country/:appid',
name: 'Comments',
url: 'appstare.net/',
example: '/appstare/comments/cn/989673964',
maintainers: ['zhixideyu'],
handler,
parameters: {
country: 'App Store country code, e.g., US, CN',
appid: 'Unique App Store application identifier (app id)',
},
categories: ['program-update'],
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['appstare.net/'],
},
],
description: 'Retrieve only the comments of the app from the past 7 days.',
};

View File

@ -0,0 +1,6 @@
import type { Namespace } from '@/types';
export const namespace: Namespace = {
name: 'AppStare',
url: 'appstare.net',
};