properly identify the error to avoid parser errors on scrapers side

This commit is contained in:
localhost 2026-02-18 23:18:04 +01:00
parent 4b3f487548
commit f4216239f3
1 changed files with 2 additions and 2 deletions

View File

@ -123,8 +123,8 @@ function hasIdentifyingUA(req: Request): boolean {
app.get('/video/:id', async ({ request, params: { id }, error }) => {
const isNice = hasIdentifyingUA(request)
if (!isNice) return `This endpoint is provided for people that prefer not to scrape, and depends on your honesty.
Please identify yourself with a User-Agent in the format: AppName/1.0 (a way for me to contact you, or a brief explanation of what you're doing).`
if (!isNice) return error(403, `This endpoint is provided for people that prefer not to scrape, and depends on your honesty.
Please identify yourself with a User-Agent in the format: AppName/1.0 (a way for me to contact you, or a brief explanation of what you're doing).`)
const cached = await redis.get(`video:${id}`)
if (cached) return JSON.parse(cached)