Update video platform for improved language and content display
Translate user interface elements and fetch video descriptions from meta tags. Replit-Commit-Author: Agent Replit-Commit-Session-Id: d7424866-83d1-4486-a212-ac12b4c7becf Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/d7424866-83d1-4486-a212-ac12b4c7becf/3kCbR9A
This commit is contained in:
parent
0a7093cba1
commit
5d36579584
@ -24,7 +24,7 @@ const formatDuration = (seconds: number): string => {
|
|||||||
|
|
||||||
const formatDate = (date: Date | string): string => {
|
const formatDate = (date: Date | string): string => {
|
||||||
const d = typeof date === 'string' ? new Date(date) : date;
|
const d = typeof date === 'string' ? new Date(date) : date;
|
||||||
return d.toLocaleDateString('sl-SI', {
|
return d.toLocaleDateString('en-US', {
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: 'long',
|
month: 'long',
|
||||||
day: 'numeric'
|
day: 'numeric'
|
||||||
@ -300,7 +300,7 @@ export default function VideoPage() {
|
|||||||
onClick={copyToClipboard}
|
onClick={copyToClipboard}
|
||||||
className="w-full px-4 py-2 text-left text-white hover:bg-gray-700"
|
className="w-full px-4 py-2 text-left text-white hover:bg-gray-700"
|
||||||
>
|
>
|
||||||
Copy link
|
Copy Link
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@ -321,7 +321,7 @@ export default function VideoPage() {
|
|||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="text-bunny-muted text-sm">
|
<div className="text-bunny-muted text-sm">
|
||||||
<p>Opis videa ni na voljo.</p>
|
<p>Video description not available.</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@ -329,7 +329,7 @@ export default function VideoPage() {
|
|||||||
|
|
||||||
{/* Recommended videos sidebar */}
|
{/* Recommended videos sidebar */}
|
||||||
<div className="lg:w-96">
|
<div className="lg:w-96">
|
||||||
<h2 className="text-lg font-semibold text-bunny-light mb-4">Recommended videos</h2>
|
<h2 className="text-lg font-semibold text-bunny-light mb-4">Recommended Videos</h2>
|
||||||
|
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
{recommendedVideos.slice(0, 10).map((video) => (
|
{recommendedVideos.slice(0, 10).map((video) => (
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { type Video, type InsertVideo } from "@shared/schema";
|
|||||||
interface BunnyVideo {
|
interface BunnyVideo {
|
||||||
guid: string;
|
guid: string;
|
||||||
title: string;
|
title: string;
|
||||||
|
description?: string;
|
||||||
length: number;
|
length: number;
|
||||||
status: number;
|
status: number;
|
||||||
dateUploaded: string;
|
dateUploaded: string;
|
||||||
@ -81,7 +82,18 @@ export class BunnyService {
|
|||||||
const iframeUrl = `https://iframe.mediadelivery.net/embed/${this.libraryId}/${bunnyVideo.guid}?preroll=false&postroll=false&ads=false`;
|
const iframeUrl = `https://iframe.mediadelivery.net/embed/${this.libraryId}/${bunnyVideo.guid}?preroll=false&postroll=false&ads=false`;
|
||||||
|
|
||||||
// Extract description from BunnyVideoDetails if available
|
// Extract description from BunnyVideoDetails if available
|
||||||
const description = 'description' in bunnyVideo ? bunnyVideo.description || "" : "";
|
let description = 'description' in bunnyVideo ? bunnyVideo.description || "" : "";
|
||||||
|
|
||||||
|
// If no description, check metaTags for description
|
||||||
|
if (!description && bunnyVideo.metaTags && bunnyVideo.metaTags.length > 0) {
|
||||||
|
const descriptionTag = bunnyVideo.metaTags.find((tag: any) =>
|
||||||
|
tag.property?.toLowerCase().includes('description') ||
|
||||||
|
tag.property?.toLowerCase().includes('summary')
|
||||||
|
);
|
||||||
|
if (descriptionTag) {
|
||||||
|
description = descriptionTag.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: bunnyVideo.guid,
|
id: bunnyVideo.guid,
|
||||||
@ -140,7 +152,7 @@ export class BunnyService {
|
|||||||
try {
|
try {
|
||||||
console.log(`Fetching video with description from Bunny: ${guid}`);
|
console.log(`Fetching video with description from Bunny: ${guid}`);
|
||||||
const bunnyVideo: BunnyVideoDetails = await this.makeRequest(`videos/${guid}`);
|
const bunnyVideo: BunnyVideoDetails = await this.makeRequest(`videos/${guid}`);
|
||||||
console.log(`Video description length: ${bunnyVideo.description?.length || 0} characters`);
|
console.log(`Fetching video: ${bunnyVideo.title} - Description available: ${!!bunnyVideo.description}`);
|
||||||
return this.bunnyVideoToVideo(bunnyVideo);
|
return this.bunnyVideoToVideo(bunnyVideo);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Error fetching video ${guid} from Bunny:`, error);
|
console.error(`Error fetching video ${guid} from Bunny:`, error);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user