Compare commits

..
1 Commits
Author SHA1 Message Date
Enes Yakıştır 116f8acfe6 fix: enhanced title normalization and bump v1.6.7 2026-10-19 17:39:24 +03:00
2 changed files with 26 additions and 4 deletions
+25 -3
View File
@@ -607,6 +607,20 @@ async function register({ getRouter, registerSetting, settingsManager, peertubeH
return false; return false;
} }
function normalizeTitleForMatch(str) {
if (!str) return '';
return String(str)
.replace(/&/g, '&')
.replace(/'/g, "'")
.replace(/"/g, '"')
.replace(/[\u2010-\u2015]/g, '-')
.replace(/\s*[\(\[](official|video|music|audio|clip|4k|hd|lyrics|sözleri|visualizer)[^\)\]]*[\)\]]/gi, '')
.replace(/[^a-zA-Z0-9\u00C0-\u024F\u1E00-\u1EFF]/g, ' ')
.replace(/\s+/g, ' ')
.trim()
.toLocaleLowerCase('tr');
}
// Helper to enrich YouTube results with existing local PeerTube videos via DB // Helper to enrich YouTube results with existing local PeerTube videos via DB
async function enrichResultsWithLocalStatus(results) { async function enrichResultsWithLocalStatus(results) {
try { try {
@@ -643,10 +657,18 @@ async function register({ getRouter, registerSetting, settingsManager, peertubeH
}; };
} }
const normalizedTitle = (item.title || '').toLowerCase().trim(); const rawItemTitle = (item.title || '').toLowerCase().trim();
const normItemTitle = normalizeTitleForMatch(item.title);
const matchedLocal = localVideos.find(lv => { const matchedLocal = localVideos.find(lv => {
const lvName = (lv.name || '').toLowerCase().trim(); const rawLv = (lv.name || '').toLowerCase().trim();
return lvName === normalizedTitle || (lvName.length > 5 && normalizedTitle.includes(lvName)); if (rawLv === rawItemTitle) return true;
const normLv = normalizeTitleForMatch(lv.name);
return (
normLv &&
(normLv === normItemTitle ||
(normLv.length > 5 && (normItemTitle.includes(normLv) || normLv.includes(normItemTitle))))
);
}); });
if (matchedLocal) { if (matchedLocal) {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "peertube-plugin-yaktube-ondemand", "name": "peertube-plugin-yaktube-ondemand",
"version": "1.6.6", "version": "1.6.7",
"description": "Accessible On-Demand YouTube Import, Live Streams, Smart Recommendations, Sleep Timer, Touch Gestures, Voice Assistant & A11y Engine for PeerTube", "description": "Accessible On-Demand YouTube Import, Live Streams, Smart Recommendations, Sleep Timer, Touch Gestures, Voice Assistant & A11y Engine for PeerTube",
"main": "main.js", "main": "main.js",
"library": "./main.js", "library": "./main.js",