Refetch missing media from catalog source
This commit is contained in:
@@ -10,6 +10,11 @@ const canonicalThumb = id => `https://i.ytimg.com/vi/${id}/hqdefault.jpg`;
|
||||
const canonicalUrl = id => `https://www.youtube.com/watch?v=${id}`;
|
||||
export const foldSearchText = value => String(value || '').normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase();
|
||||
export const channelKey = c => String(c.channelId || c.channel || '').toLowerCase().replace(/\s*-\s*topic$|vevo$|\s+official$/g, '').trim();
|
||||
export async function getSourceUrl(id) {
|
||||
if (!VIDEO_ID.test(String(id || ''))) return null;
|
||||
const row = (await db.execute({ sql: 'SELECT url FROM video_meta WHERE id=?', args: [id] })).rows[0];
|
||||
return row?.url || `https://www.youtube.com/watch?v=${id}`;
|
||||
}
|
||||
function safeThumbnail(url) {
|
||||
try { const u = new URL(url); return u.protocol === 'https:' && /^(?:i|i\d)\.ytimg\.com$/.test(u.hostname) && !u.port && !u.username && !u.password; }
|
||||
catch { return false; }
|
||||
|
||||
Reference in New Issue
Block a user