feat(api): Prime Video scraping ve saglayiciya duyarlı metadata destegi ekle

This commit is contained in:
2026-03-01 01:13:41 +03:00
parent 96d8a66a97
commit 84131576cf
11 changed files with 515 additions and 166 deletions

View File

@@ -1,27 +1,19 @@
import { Request, Response, NextFunction } from 'express';
import { z } from 'zod';
import type { ApiResponse, GetInfoRequest } from '../types/index.js';
import { isSupportedContentUrl } from '../utils/contentUrl.js';
/**
* Validation schema for /api/getinfo endpoint
*/
const getInfoSchema = z.object({
url: z.string().url('Invalid URL format').refine((url) => {
// Validate Netflix URL
try {
const parsedUrl = new URL(url);
const validHosts = [
'www.netflix.com',
'netflix.com',
'www.netflix.com.tr',
'netflix.com.tr',
];
const hasTitlePath = /\/title\/\d+/.test(url);
return validHosts.includes(parsedUrl.hostname) && hasTitlePath;
} catch {
return false;
}
}, 'URL must be a valid Netflix title URL (e.g., https://www.netflix.com/tr/title/81616256)'),
url: z
.string()
.url('Invalid URL format')
.refine(
(url) => isSupportedContentUrl(url),
'URL must be Netflix /title/... or PrimeVideo /detail/...'
),
});
/**