From fc951d103bc1ca0e6f5836187330f8f5910b8999 Mon Sep 17 00:00:00 2001 From: Honey Date: Sun, 26 Apr 2026 17:48:35 +0200 Subject: [PATCH] fix: use iTunes US catalog + explicit=Yes to show all tracks including explicit country=de silently filtered explicit content from iTunes results. Switched to country=us&explicit=Yes so all songs appear regardless of explicit flag. Removed wrong explicit-filtering code from views.js. Co-Authored-By: Claude Sonnet 4.6 --- src/api.js | 2 +- src/views.js | 24 +++++++++--------------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/api.js b/src/api.js index 1e0c169..de253ac 100644 --- a/src/api.js +++ b/src/api.js @@ -37,7 +37,7 @@ export async function ndAuth() { const ITUNES = 'https://itunes.apple.com'; export async function itunesSearch(query, entity='musicTrack', limit=25) { - const r = await fetch(`${ITUNES}/search?term=${encodeURIComponent(query)}&media=music&entity=${entity}&limit=${limit}&country=de`); + const r = await fetch(`${ITUNES}/search?term=${encodeURIComponent(query)}&media=music&entity=${entity}&limit=${limit}&country=us&explicit=Yes`); const d = await r.json(); return d.results || []; } diff --git a/src/views.js b/src/views.js index eb5034d..42dd916 100644 --- a/src/views.js +++ b/src/views.js @@ -305,7 +305,7 @@ export async function loadArtistDetail(artist) { // ── iTunes: global top tracks ── const itunesTracks = itunesTracksRes.status==='fulfilled' - ? (itunesTracksRes.value||[]).filter(t => t.wrapperType==='track' && !isExplicit(t) && t.artistName?.toLowerCase()===artist.name.toLowerCase()) + ? (itunesTracksRes.value||[]).filter(t => t.wrapperType==='track' && t.artistName?.toLowerCase()===artist.name.toLowerCase()) : []; if(itunesTracks.length) { const tsEl = document.getElementById('artist-topsongs-section'); @@ -325,8 +325,7 @@ export async function loadArtistDetail(artist) { const serverAlbumNames = new Set((albumRes.status==='fulfilled' ? (albumRes.value.artist?.album||[]) : []).map(a => a.name.toLowerCase())); const extraAlbums = itunesAlbums.filter(a => (a.artistId === undefined || a.artistName?.toLowerCase() === artist.name.toLowerCase()) && - !serverAlbumNames.has(a.collectionName?.toLowerCase()) && - !isExplicit(a) + !serverAlbumNames.has(a.collectionName?.toLowerCase()) ); if(extraAlbums.length) { const g = document.getElementById('artist-albums-grid'); @@ -541,8 +540,8 @@ export async function doGlobalSearch(q) { ]); el.innerHTML = ''; - const trackResults = tracks.filter(t => t.wrapperType === 'track' && !isExplicit(t)); - const albumResults = albums.filter(a => !isExplicit(a)); + const trackResults = tracks.filter(t => t.wrapperType === 'track'); + const albumResults = albums; if(artists.length) { const s = mkSection('Künstler'); @@ -600,8 +599,7 @@ export async function doGlobalSearch(q) { export async function loadItunesAlbum(album) { try { - const rawTracks = await itunesLookupAlbum(album.collectionId); - const tracks = rawTracks.filter(t => !isExplicit(t)); + const tracks = await itunesLookupAlbum(album.collectionId); if(!tracks.length) { toast('Keine Tracks gefunden'); return; } const el = document.getElementById('global-search-results'); const s = document.createElement('div'); s.className = 'search-section'; @@ -629,8 +627,8 @@ export async function loadItunesArtistResults(artistId, artistName) { itunesSearch(artistName, 'album', 20), itunesSearch(artistName, 'musicTrack', 10), ]); - const artistAlbums = albums.filter(a => (a.artistId===artistId || a.artistName===artistName) && !isExplicit(a)); - const artistTracks = topTracks.filter(t => t.wrapperType==='track' && !isExplicit(t) && (t.artistId===artistId || t.artistName===artistName)); + const artistAlbums = albums.filter(a => a.artistId===artistId || a.artistName===artistName); + const artistTracks = topTracks.filter(t => t.wrapperType==='track' && (t.artistId===artistId || t.artistName===artistName)); const coverImg = artistAlbums[0]?.artworkUrl100?.replace('100x100','600x600') || ''; el.innerHTML = ''; @@ -797,16 +795,12 @@ async function loadItunesFallbackRecommendations(el, artist, title, html) { const sec = document.createElement('div'); sec.innerHTML = `
Mehr von ${esc(artist)}
`; const list = document.createElement('div'); list.className = 'song-list'; - results.filter(t => t.artistName===artist && !isExplicit(t)).slice(0,15).forEach(t => list.appendChild(makeGlobalTrackItem(t, 0, [t]))); - if(!list.children.length) results.filter(t => !isExplicit(t)).slice(0,15).forEach(t => list.appendChild(makeGlobalTrackItem(t, 0, [t]))); + results.filter(t => t.artistName===artist).slice(0,15).forEach(t => list.appendChild(makeGlobalTrackItem(t, 0, [t]))); + if(!list.children.length) results.slice(0,15).forEach(t => list.appendChild(makeGlobalTrackItem(t, 0, [t]))); sec.appendChild(list); el.appendChild(sec); } // ─── HELPERS ─── -function isExplicit(item) { - return item.trackExplicitness === 'explicit' || item.collectionExplicitness === 'explicit'; -} - export function expandArtistBio() { const el = document.getElementById('artist-bio-text'); if(el && window._artistBioFull) el.textContent = window._artistBioFull;