Skip to content

Commit 0ddea9e

Browse files
authored
fix(route): apple apps (#21824)
1 parent bd31ae1 commit 0ddea9e

3 files changed

Lines changed: 8 additions & 38 deletions

File tree

lib/routes/apple/apps.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { ViewType } from '@/types';
33
import ofetch from '@/utils/ofetch';
44
import { parseDate } from '@/utils/parse-date';
55

6-
import { appstoreBearerToken } from './utils';
7-
86
const platformIds = {
97
osx: 'macOS',
108
ios: 'iOS',
@@ -87,20 +85,20 @@ async function handler(ctx) {
8785
const rootUrl = 'https://apps.apple.com';
8886
const currentUrl = new URL(`${country}/app/${id}`, rootUrl).href;
8987

90-
const bearer = await appstoreBearerToken();
91-
92-
const response = await ofetch(`https://amp-api-edge.apps.apple.com/v1/catalog/${country}/apps/${id.replace('id', '')}`, {
88+
const response = await ofetch(`https://apps.apple.com/api/apps/v1/catalog/${country}/apps/${id.replace('id', '')}`, {
9389
headers: {
94-
authorization: `Bearer ${bearer}`,
90+
authorization: 'Bearer',
9591
origin: 'https://apps.apple.com',
9692
},
9793
query: {
9894
platform: 'iphone',
9995
additionalPlatforms: 'appletv,ipad,iphone,mac,realityDevice,watch',
100-
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',
96+
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',
97+
'extend[apps]': 'distributionKind,isVerifiedForAppleSiliconMac',
10198
'extend[app-events]': 'description,productArtwork,productVideo',
102-
include: 'alternate-apps,app-bundles,customers-also-bought-apps,developer,developer-other-apps,merchandised-in-apps,related-editorial-items,reviews,top-in-apps',
99+
include: 'alternate-apps,app-bundles,customers-also-bought-apps,developer,developer-other-apps,merchandised-in-apps,related-editorial-items,reviews',
103100
'include[apps]': 'app-events',
101+
views: 'top-in-app-purchasables',
104102
'availableIn[app-events]': 'future',
105103
'sparseLimit[apps:customers-also-bought-apps]': 40,
106104
'sparseLimit[apps:developer-other-apps]': 40,

lib/routes/apple/utils.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

lib/routes/appstore/in-app-purchase.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { load } from 'cheerio';
22

3-
import { appstoreBearerToken } from '@/routes/apple/utils';
43
import type { Route } from '@/types';
54
import ofetch from '@/utils/ofetch';
65

@@ -33,11 +32,10 @@ async function handler(ctx) {
3332
const res = await ofetch(link);
3433
const $ = load(res);
3534
const lang = $('html').attr('lang');
36-
const mediaToken = await appstoreBearerToken();
3735

38-
const apiResponse = await ofetch(`https://amp-api-edge.apps.apple.com/v1/catalog/${country}/apps/${id.replace('id', '')}`, {
36+
const apiResponse = await ofetch(`https://apps.apple.com/api/apps/v1/catalog/${country}/apps/${id.replace('id', '')}`, {
3937
headers: {
40-
authorization: `Bearer ${mediaToken}`,
38+
authorization: 'Bearer',
4139
origin: 'https://apps.apple.com',
4240
},
4341
query: {

0 commit comments

Comments
 (0)