From a89a5483d1b7b32dce1b96a35dbb470916e5fc8e Mon Sep 17 00:00:00 2001 From: dargy Date: Sun, 9 Jun 2024 00:30:47 -0500 Subject: [PATCH] feat: add ended and move avatar --- src/services/tiktok.ts | 4 ---- src/templates/pages/LiveResponse.tsx | 21 ++++++++++++++++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/services/tiktok.ts b/src/services/tiktok.ts index e48b4ba..4e882b6 100644 --- a/src/services/tiktok.ts +++ b/src/services/tiktok.ts @@ -55,10 +55,6 @@ export async function scrapeLiveData(author: string): Promise Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0', Cookie: cookie.getCookiesAsString() - }, - cf: { - cacheEverything: true, - cacheTtlByStatus: { '200-299': 86400, 404: 1, '500-599': 0 } } }) diff --git a/src/templates/pages/LiveResponse.tsx b/src/templates/pages/LiveResponse.tsx index e983090..2c9a96a 100644 --- a/src/templates/pages/LiveResponse.tsx +++ b/src/templates/pages/LiveResponse.tsx @@ -6,7 +6,14 @@ export function LiveResponse(data: LiveRoom): JSX.Element { let title = '' title += `👀 ${formatNumber(String(data.liveRoomUserInfo.liveRoom.liveRoomStats.userCount))} ` - title += `🕒 ${formatTime(data.liveRoomUserInfo.liveRoom.startTime)} ` + + console.log(data.liveRoomUserInfo.liveRoom.status) + if(data.liveRoomUserInfo.liveRoom.status !== 4) { // live has NOT ended + title += `🔴 LIVE ` + title += `🕒 ${formatTime(data.liveRoomUserInfo.liveRoom.startTime)} ` + } else { + title += `⌛ ENDED ` + } return ( <> @@ -43,6 +50,18 @@ export function LiveResponse(data: LiveRoom): JSX.Element { { name: 'og:image', content: data.liveRoomUserInfo.user.avatarLarger + }, + { + name: 'og:image:type', + content: 'image/jpeg' + }, + { + name: 'og:type', + content: 'image.other' + }, + { + name: 'twitter:card', + content: 'summary_large_image' } ], {