diff options
| author | Fuwn <[email protected]> | 2024-02-07 01:16:21 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-02-07 01:16:21 -0800 |
| commit | 1aa2a1eaa539dfe2028237058c0e3318f34aa05e (patch) | |
| tree | 6f7e5241fa554dc774d249e0f33ef8db0c3ed243 /src/routes/api | |
| parent | feat(hololive): add head title (diff) | |
| download | due.moe-1aa2a1eaa539dfe2028237058c0e3318f34aa05e.tar.xz due.moe-1aa2a1eaa539dfe2028237058c0e3318f34aa05e.zip | |
feat(hololive): re-implement get schedule html
Diffstat (limited to 'src/routes/api')
| -rw-r--r-- | src/routes/api/hololive/+server.ts | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/routes/api/hololive/+server.ts b/src/routes/api/hololive/+server.ts index 331d776a..8cf3fbca 100644 --- a/src/routes/api/hololive/+server.ts +++ b/src/routes/api/hololive/+server.ts @@ -1,10 +1,20 @@ import parseScheduleHtml from 'holo-schedule'; -import getScheduleHtml from 'holo-schedule/lib/getScheduleHtml'; -export const GET = async () => - Response.json(parseScheduleHtml(await getScheduleHtml()), { - headers: { - 'Access-Control-Allow-Origin': 'https://due.moe', - 'Cache-Control': 'public, max-age=300, s-maxage=300' +export const GET = async ({ url }) => + Response.json( + parseScheduleHtml( + await ( + await fetch('https://schedule.hololive.tv', { + headers: { + Cookie: `timezone=${url.searchParams.get('timezone') || 'Asia/Tokyo'}` + } + }) + ).text() + ), + { + headers: { + 'Access-Control-Allow-Origin': 'https://due.moe', + 'Cache-Control': 'public, max-age=300, s-maxage=300' + } } - }); + ); |