feat(api): Prime Video scraping ve saglayiciya duyarlı metadata destegi ekle
This commit is contained in:
@@ -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/...'
|
||||
),
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user