chore: update Angular cache and TypeScript build info

This commit is contained in:
2025-09-23 21:45:57 -04:00
parent d372b7d509
commit 9a3983a253
18 changed files with 664 additions and 169 deletions
+49 -3
View File
@@ -36,6 +36,45 @@ export class YoutubeApiService {
this.ytKeys = this.loadYouTubeKeys();
}
private normalizeDuration(raw: any): number {
if (typeof raw === 'number' && Number.isFinite(raw)) {
return raw > 0 ? Math.round(raw) : 0;
}
if (typeof raw === 'string') {
const value = raw.trim();
if (!value) return 0;
const numeric = Number(value);
if (Number.isFinite(numeric)) {
return numeric > 0 ? Math.round(numeric) : 0;
}
const spaced = value.replace(/[,]/g, '').trim();
const spaceMatch = spaced.match(/^(\d+)[\s]+(\d{1,2}):(\d{2})$/);
if (spaceMatch) {
const hours = Number(spaceMatch[1]);
const minutes = Number(spaceMatch[2]);
const seconds = Number(spaceMatch[3]);
const total = hours * 3600 + minutes * 60 + seconds;
if (total > 0) return total;
}
const colonized = value.replace(/[^0-9:]/g, '');
if (colonized.includes(':')) {
const segments = colonized.split(':').filter(Boolean).map(part => Number(part));
if (segments.length >= 2 && segments.every(segment => Number.isFinite(segment))) {
while (segments.length < 3) segments.unshift(0);
const [hours, minutes, seconds] = segments.slice(-3);
const total = hours * 3600 + minutes * 60 + seconds;
if (total > 0) return total;
}
}
}
return 0;
}
// Some Odysee API responses return thumbnail URLs on hosts like "thumbs.odycdn.com"
// that can be flaky or blocked by the browser. Prefer the canonical
// "thumbnails.odycdn.com" host and ensure https scheme.
@@ -659,7 +698,12 @@ export class YoutubeApiService {
const thumbRaw = val?.thumbnail?.url || '';
const thumb = this.proxiedOdyseeThumb(thumbRaw);
const publishedAt = val?.release_time ? new Date(val.release_time * 1000).toISOString() : '';
const duration = val?.video?.duration || 0;
const rawDuration = val?.video?.duration
?? i?.duration
?? val?.duration
?? i?.meta?.duration
?? (typeof i?.value?.duration !== 'undefined' ? i.value.duration : undefined);
const duration = this.normalizeDuration(rawDuration);
const views = (i?.meta?.view_count != null) ? Number(i.meta.view_count) : 0;
const uploaderName = channelVal?.title || channel?.name || '';
@@ -674,7 +718,7 @@ export class YoutubeApiService {
uploaderUrl: channel?.permanent_url ? this.lbryToOdyseeUrl(channel.permanent_url) : '',
uploaderAvatar: this.proxiedOdyseeThumb(channelVal?.thumbnail?.url) || thumb,
uploadedDate: publishedAt,
duration: Number(duration || 0),
duration,
views: views,
uploaded: publishedAt ? Date.parse(publishedAt) : 0,
} as Video;
@@ -689,7 +733,9 @@ export class YoutubeApiService {
const uploaderAvatar = i?.author_avatar || i?.uploader_avatar || i?.channel?.avatar || i?.uploaderAvatar || thumb || '';
const uploadedDate = i?.published_at || i?.created_at || i?.uploadedDate || '';
const views = Number(i?.views || i?.view_count || 0);
const duration = Number(i?.duration || 0);
const duration = this.normalizeDuration(
i?.duration ?? i?.durationSeconds ?? i?.duration_seconds ?? i?.video_duration ?? i?.length ?? i?.meta?.duration
);
const url = i?.url || (id ? `https://rumble.com/${id}` : '');
if (!id && url) {
try {