diff --git a/src/services/tiktok.ts b/src/services/tiktok.ts index 00728fc..6c4785c 100644 --- a/src/services/tiktok.ts +++ b/src/services/tiktok.ts @@ -17,11 +17,16 @@ export async function grabAwemeId(videoId: string): Promise { export async function getVideoInfo(awemeId: String): Promise { // https://api16-normal-c-useast1a.tiktokv.com/aweme/v1/feed/7311925846594342175 - const res: Response = await fetch('https://api16-normal-c-useast1a.tiktokv.com/aweme/v1/feed/?aweme_id=' + awemeId) + const res: Response = await fetch('https://api16-normal-c-useast1a.tiktokv.com/aweme/v1/feed/?aweme_id=' + awemeId, { + cf: { + cacheEverything: true, + cacheTtlByStatus: { "200-299": 86400, 404: 1, "500-599": 0 }, + }, + }) const json: TikTokAPIResponse = await res.json() const videoInfo: AwemeList | undefined = json.aweme_list.find((aweme) => aweme.aweme_id === awemeId) - - if(videoInfo) { + + if (videoInfo) { return videoInfo } else { return new Error('Could not find video info')