Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
deps = pkgs.fetchPnpmDeps {
pname = "rsshub";
src = ./.;
hash = "sha256-JSMYPsZo2shfh/f6yQ+dOujhSkS3Ras0DcOo378pej4=";
hash = "sha256-ek3LN43FqwmLGh4qk54DZ8FwZZs9DmUKVUPDzwKOj6c=";
fetcherVersion = 2;
};
in
Expand Down
8 changes: 7 additions & 1 deletion lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ type ConfigEnvKeys =
| 'YOUTUBE_CLIENT_SECRET'
| 'YOUTUBE_REFRESH_TOKEN'
| 'YOUTUBE_VIDEO_EMBED_URL'
| 'ZAIMANHUA_TOKEN'
| 'ZHIHU_COOKIES'
| 'ZODGAME_COOKIE'
| 'ZSXQ_ACCESS_TOKEN'
Expand Down Expand Up @@ -692,6 +693,9 @@ export type Config = {
refreshToken?: string;
videoEmbedUrl?: string;
};
zaimanhua: {
token?: string;
};
zhihu: {
cookies?: string;
};
Expand Down Expand Up @@ -1192,6 +1196,9 @@ const calculateValue = () => {
refreshToken: envs.YOUTUBE_REFRESH_TOKEN,
videoEmbedUrl: envs.YOUTUBE_VIDEO_EMBED_URL || 'https://www.youtube-nocookie.com/embed/',
},
zaimanhua: {
token: envs.ZAIMANHUA_TOKEN,
},
zhihu: {
cookies: envs.ZHIHU_COOKIES,
},
Expand All @@ -1211,7 +1218,6 @@ const calculateValue = () => {
}
};
calculateValue();

(async () => {
if (envs.REMOTE_CONFIG) {
const { default: logger } = await import('@/utils/logger');
Expand Down
14 changes: 6 additions & 8 deletions lib/routes/apple/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { ViewType } from '@/types';
import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';

import { appstoreBearerToken } from './utils';

const platformIds = {
osx: 'macOS',
ios: 'iOS',
Expand Down Expand Up @@ -87,20 +85,20 @@ async function handler(ctx) {
const rootUrl = 'https://apps.apple.com';
const currentUrl = new URL(`${country}/app/${id}`, rootUrl).href;

const bearer = await appstoreBearerToken();

const response = await ofetch(`https://amp-api-edge.apps.apple.com/v1/catalog/${country}/apps/${id.replace('id', '')}`, {
const response = await ofetch(`https://apps.apple.com/api/apps/v1/catalog/${country}/apps/${id.replace('id', '')}`, {
headers: {
authorization: `Bearer ${bearer}`,
authorization: 'Bearer',
origin: 'https://apps.apple.com',
},
query: {
platform: 'iphone',
additionalPlatforms: 'appletv,ipad,iphone,mac,realityDevice,watch',
extend: 'accessibility,accessibilityDetails,ageRating,backgroundAssetsInfo,backgroundAssetsInfoWithOptional,customArtwork,customDeepLink,customIconArtwork,customPromotionalText,customScreenshotsByType,customVideoPreviewsByType,description,expectedReleaseDateDisplayFormat,fileSizeByDevice,gameDisplayName,iconArtwork,installSizeByDeviceInBytes,messagesScreenshots,miniGamesDeepLink,minimumOSVersion,privacy,privacyDetails,privacyPolicyUrl,remoteControllerRequirement,requirementsByDeviceFamily,supportURLForLanguage,supportedGameCenterFeatures,supportsFunCamera,supportsSharePlay,versionHistory,websiteUrl',
extend: 'accessibility,accessibilityDetails,ageRating,backgroundAssetsInfo,backgroundAssetsInfoWithOptional,customArtwork,customDeepLink,customIconArtwork,customPromotionalText,customScreenshotsByType,customVideoPreviewsByType,description,expectedReleaseDateDisplayFormat,fileSizeByDevice,gameDisplayName,iconArtwork,installSizeByDeviceInBytes,macRequiredCapabilities,medicalDeviceInfo,messagesScreenshots,miniGamesDeepLink,minimumOSVersion,privacy,privacyDetails,privacyPolicyUrl,remoteControllerRequirement,requirementsByDeviceFamily,supportURLForLanguage,supportedGameCenterFeatures,supportsFunCamera,supportsSharePlay,versionHistory,websiteUrl',
'extend[apps]': 'distributionKind,isVerifiedForAppleSiliconMac',
'extend[app-events]': 'description,productArtwork,productVideo',
include: 'alternate-apps,app-bundles,customers-also-bought-apps,developer,developer-other-apps,merchandised-in-apps,related-editorial-items,reviews,top-in-apps',
include: 'alternate-apps,app-bundles,customers-also-bought-apps,developer,developer-other-apps,merchandised-in-apps,related-editorial-items,reviews',
'include[apps]': 'app-events',
views: 'top-in-app-purchasables',
'availableIn[app-events]': 'future',
'sparseLimit[apps:customers-also-bought-apps]': 40,
'sparseLimit[apps:developer-other-apps]': 40,
Expand Down
26 changes: 0 additions & 26 deletions lib/routes/apple/utils.ts

This file was deleted.

6 changes: 2 additions & 4 deletions lib/routes/appstore/in-app-purchase.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { load } from 'cheerio';

import { appstoreBearerToken } from '@/routes/apple/utils';
import type { Route } from '@/types';
import ofetch from '@/utils/ofetch';

Expand Down Expand Up @@ -33,11 +32,10 @@ async function handler(ctx) {
const res = await ofetch(link);
const $ = load(res);
const lang = $('html').attr('lang');
const mediaToken = await appstoreBearerToken();

const apiResponse = await ofetch(`https://amp-api-edge.apps.apple.com/v1/catalog/${country}/apps/${id.replace('id', '')}`, {
const apiResponse = await ofetch(`https://apps.apple.com/api/apps/v1/catalog/${country}/apps/${id.replace('id', '')}`, {
headers: {
authorization: `Bearer ${mediaToken}`,
authorization: 'Bearer',
origin: 'https://apps.apple.com',
},
query: {
Expand Down
37 changes: 23 additions & 14 deletions lib/routes/zaimanhua/comic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ export const route: Route = {
path: '/comic/:id',
categories: ['anime'],
parameters: { id: '漫画ID' },
example: '/zaimanhua/comic/14488',
example: '/zaimanhua/comic/57069',
features: {
requireConfig: false,
requireConfig: [
{
name: 'ZAIMANHUA_TOKEN',
optional: true,
description: '用户登录后,可以从浏览器开发者工具 Network 面板中的请求信息中获取 token,使用请求中的 `Authorization` 的值,完整设置为 `Bearer <token>`,或直接设置 token 并由路由自动补齐 `Bearer ` 前缀。',
},
],
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
Expand All @@ -30,6 +36,9 @@ export const route: Route = {
],
name: '漫画更新',
maintainers: ['kjasn'],
description: `::: Warning
未登录用户无法获取到所有漫画,需要设置\`ZAIMANHUA_TOKEN\`环境变量以使用 API 授权访问。
:::`,
handler,
};

Expand All @@ -38,12 +47,17 @@ async function handler(ctx) {
const id = ctx.req.param('id');
const currentComicUrl = `${baseUrl}/api/v1/comic2/comic/detail?id=${id}`;

const response = await ofetch(currentComicUrl, {
headers: {
'user-agent': config.trueUA,
referer: baseUrl,
},
});
const headers: Record<string, string> = {
'user-agent': config.trueUA,
referer: baseUrl,
};

const token = config.zaimanhua.token;
if (token) {
headers.Authorization = token.startsWith('Bearer ') ? token : `Bearer ${token}`;
}

const response = await ofetch(currentComicUrl, { headers });

const comicInfo = response.data.comicInfo;
const status = comicInfo.chapterList[0].title; // 更新状态
Expand All @@ -58,12 +72,7 @@ async function handler(ctx) {

return await cache.tryGet(chapterUrl, async () => {
// 获取章节内容
const chapterResponse = await ofetch(chapterUrl, {
headers: {
'user-agent': config.trueUA,
referer: baseUrl,
},
});
const chapterResponse = await ofetch(chapterUrl, { headers });

const chapterData = chapterResponse.data;
const description = renderComic(chapterData.chapterInfo.page_url || []);
Expand Down
31 changes: 20 additions & 11 deletions lib/routes/zaimanhua/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ export const route: Route = {
categories: ['anime'],
example: '/zaimanhua/update',
features: {
requireConfig: false,
requireConfig: [
{
name: 'ZAIMANHUA_TOKEN',
optional: true,
description: '可从浏览器开发者工具中抓取站点请求头 `Authorization` 的 Bearer token,并配置为环境变量。可设置为完整值 `Bearer <token>`,或仅设置 token 由路由自动补齐 `Bearer ` 前缀。',
},
],
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
Expand All @@ -29,15 +35,23 @@ export const route: Route = {
],
name: '最近更新',
maintainers: ['kjasn'],
description: `::: Warning
建议设置\`ZAIMANHUA_TOKEN\`环境变量以使用 API 授权访问。
:::`,
handler: async () => {
const baseUrl = 'https://manhua.zaimanhua.com';
const currentUrl = `${baseUrl}/api/v1/comic2/update_list?status&theme&zone&cate&firstLetter&sortType&page=1&size=20`;
const headers: Record<string, string> = {
'user-agent': config.trueUA,
referer: baseUrl,
};
const token = config.zaimanhua.token;
if (token) {
headers.Authorization = token.startsWith('Bearer ') ? token : `Bearer ${token}`;
}

const response = await ofetch(currentUrl, {
headers: {
'user-agent': config.trueUA,
referer: baseUrl,
},
headers,
});

// 近期更新漫画数据
Expand All @@ -53,12 +67,7 @@ export const route: Route = {

return await cache.tryGet(chapterUrl, async () => {
// 获取章节内容
const chapterResponse = await ofetch(chapterUrl, {
headers: {
'user-agent': config.trueUA,
referer: baseUrl,
},
});
const chapterResponse = await ofetch(chapterUrl, { headers });

const chapterData = chapterResponse.data;
const description = renderComic(chapterData.chapterInfo.page_url || []);
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@opentelemetry/sdk-trace-base": "2.7.0",
"@opentelemetry/semantic-conventions": "1.40.0",
"@rss3/sdk": "0.0.25",
"@scalar/hono-api-reference": "0.10.9",
"@scalar/hono-api-reference": "0.10.10",
"@sentry/node": "10.49.0",
"aes-js": "3.1.2",
"cheerio": "1.2.0",
Expand All @@ -89,7 +89,7 @@
"google-play-scraper": "10.1.2",
"googleapis": "171.4.0",
"header-generator": "2.1.82",
"hono": "4.12.14",
"hono": "4.12.15",
"html-to-text": "9.0.5",
"http-cookie-agent": "7.0.3",
"https-proxy-agent": "9.0.0",
Expand Down Expand Up @@ -118,7 +118,7 @@
"puppeteer-real-browser": "1.4.4",
"query-string": "9.3.1",
"rate-limiter-flexible": "11.0.1",
"re2js": "2.2.0",
"re2js": "2.2.2",
"rebrowser-puppeteer": "24.8.1",
"rfc4648": "1.5.4",
"rss-parser": "3.13.0",
Expand Down
Loading
Loading