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 = `