This commit is contained in:
Andrey Kondratev
2025-08-29 18:26:00 +05:00
parent 9bdf522f59
commit 82d2713d15
6 changed files with 36 additions and 8 deletions

View File

@@ -46,6 +46,7 @@ class QuixoticApp {
private noResults!: HTMLElement;
private welcomePlaceholder!: HTMLElement;
private searchTimeout?: NodeJS.Timeout;
private currentVideos: VideoResult[] = [];
constructor() {
this.tg = (window as WindowWithTelegram).Telegram?.WebApp;
@@ -194,6 +195,9 @@ class QuixoticApp {
return;
}
// Store current videos for metadata access
this.currentVideos = videos;
// Hide welcome and no results
this.welcomePlaceholder.classList.add('tg-hidden');
this.welcomePlaceholder.style.display = 'none';
@@ -255,6 +259,11 @@ class QuixoticApp {
public async convertVideo(videoId: string, title: string, url: string): Promise<void> {
console.log('🎵 Converting:', title);
// Find video metadata from current search results
const video = this.currentVideos.find(v => v.id.toString() === videoId);
const performer = video?.channel || 'Unknown Artist';
const thumbnail = video?.thumbnail || '';
// Find the clicked element by looking for the one that contains this videoId
const videoElement = document.querySelector(`[onclick*="${videoId}"]`) as HTMLElement;
if (videoElement) {
@@ -304,7 +313,9 @@ class QuixoticApp {
body: JSON.stringify({
userId: userId,
audioUrl: data.audioUrl,
title: title
title: title,
performer: performer,
thumbnail: thumbnail
})
});