feat: centralize isPlaylistUrl function as a helper that could be upgraded in the future

This commit is contained in:
MasterAcnolo
2026-08-22 22:09:01 +02:00
parent 104500a82a
commit 8ec901dc07
3 changed files with 35 additions and 34 deletions

View File

@@ -2,6 +2,7 @@ const { fetchInfo } = require("../services/info.services");
const { parseVideo, parsePlaylist } = require("../helpers/parseInfo.helpers");
const { logger } = require("../logger");
const { isValidUrl } = require("../helpers/validation.helpers");
const {isUrlPlaylist} = require("../helpers/playlist.helpers");
/**
* Handles metadata retrieval for a video or playlist.
@@ -36,7 +37,7 @@ async function infoController(req, res) {
logger.info(`Info request received. ENCODED: ${encodedUrl}`);
// Lightweight heuristic to detect playlist URLs. It works for Youtube.
const isPlaylistUrl = url.includes("&list") || url.includes("?list");
const isPlaylistUrl = isUrlPlaylist(url);
logger.info(
isPlaylistUrl