Top 4 Favorites
Use /top4 to drive static profile sections without extra API calls.
Example
Section titled “Example”async function loadTopFavorites(username) { const res = await fetch(`https://api.interis.gorkemkaryol.dev/api/public/${username}/top4`); if (!res.ok) throw new Error(`Top picks failed: ${res.status}`);
const data = await res.json(); const categories = Object.fromEntries( data.categories.map((category) => [category.key, category.items]) );
return { films: categories.cinema ?? [], series: categories.serial ?? [], };}
const { films, series } = await loadTopFavorites('your_username');Render helper
Section titled “Render helper”function toFavoritesMarkup(title, items) { return ` <section> <h3>${title}</h3> <ul> ${items .map( (item) => `<li data-slot="${item.slot}">${item.title ?? 'Untitled'} (${item.releaseYear ?? 'n/a'})</li>` ) .join('')} </ul> </section> `;}- Keep fallback text for
titleandreleaseYearwhen values arenull. - Use
slotto preserve user ranking order.