aboutsummaryrefslogtreecommitdiff
path: root/src/routes/api/hololive/+server.ts
blob: 8cf3fbcab662f85978b9105d556107595aadea42 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import parseScheduleHtml from 'holo-schedule';

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'
			}
		}
	);