Fix GIF display for Klipy format

This commit is contained in:
Your Name 2026-07-22 04:46:29 +03:00
parent 203713da2c
commit 930c723759
1 changed files with 4 additions and 3 deletions

View File

@ -320,9 +320,10 @@
return;
}
gifGrid.innerHTML = results.map(gif => {
// Use the actual media URL, not the Tenor page URL
const thumbUrl = gif.media_formats?.tinygif?.url || gif.media_formats?.gif?.url || gif.url;
const fullUrl = gif.media_formats?.gif?.url || thumbUrl;
// Klipy format: file=hd, md=medium, sm=small, xs=tiny
const sizes = gif.file?.gif?.url ? gif.file : (gif.md || gif.sm || gif.xs || {});
const thumbUrl = sizes?.gif?.url || gif.sm?.gif?.url || gif.xs?.gif?.url || '';
const fullUrl = gif.file?.gif?.url || gif.md?.gif?.url || thumbUrl;
return `<img src="${escapeHtml(thumbUrl)}" alt="gif" data-gif-url="${escapeHtml(fullUrl)}">`;
}).join('');