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 <noreply@anthropic.com>
This commit is contained in:
1 parent
31e5940ab6
commit
fc951d103b
2 files changed
+10
-16
No files matched your search
+1
-1
@@ -37,7 +37,7 @@ export async function ndAuth() {
|
|||||||
const ITUNES = 'https://itunes.apple.com';
|
const ITUNES = 'https://itunes.apple.com';
|
||||||
|
|
||||||
export async function itunesSearch(query, entity='musicTrack', limit=25) {
|
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();
|
const d = await r.json();
|
||||||
return d.results || [];
|
return d.results || [];
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-15
@@ -305,7 +305,7 @@ export async function loadArtistDetail(artist) {
|
|||||||
|
|
||||||
// ── iTunes: global top tracks ──
|
// ── iTunes: global top tracks ──
|
||||||
const itunesTracks = itunesTracksRes.status==='fulfilled'
|
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) {
|
if(itunesTracks.length) {
|
||||||
const tsEl = document.getElementById('artist-topsongs-section');
|
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 serverAlbumNames = new Set((albumRes.status==='fulfilled' ? (albumRes.value.artist?.album||[]) : []).map(a => a.name.toLowerCase()));
|
||||||
const extraAlbums = itunesAlbums.filter(a =>
|
const extraAlbums = itunesAlbums.filter(a =>
|
||||||
(a.artistId === undefined || a.artistName?.toLowerCase() === artist.name.toLowerCase()) &&
|
(a.artistId === undefined || a.artistName?.toLowerCase() === artist.name.toLowerCase()) &&
|
||||||
!serverAlbumNames.has(a.collectionName?.toLowerCase()) &&
|
!serverAlbumNames.has(a.collectionName?.toLowerCase())
|
||||||
!isExplicit(a)
|
|
||||||
);
|
);
|
||||||
if(extraAlbums.length) {
|
if(extraAlbums.length) {
|
||||||
const g = document.getElementById('artist-albums-grid');
|
const g = document.getElementById('artist-albums-grid');
|
||||||
@@ -541,8 +540,8 @@ export async function doGlobalSearch(q) {
|
|||||||
]);
|
]);
|
||||||
el.innerHTML = '';
|
el.innerHTML = '';
|
||||||
|
|
||||||
const trackResults = tracks.filter(t => t.wrapperType === 'track' && !isExplicit(t));
|
const trackResults = tracks.filter(t => t.wrapperType === 'track');
|
||||||
const albumResults = albums.filter(a => !isExplicit(a));
|
const albumResults = albums;
|
||||||
|
|
||||||
if(artists.length) {
|
if(artists.length) {
|
||||||
const s = mkSection('Künstler');
|
const s = mkSection('Künstler');
|
||||||
@@ -600,8 +599,7 @@ export async function doGlobalSearch(q) {
|
|||||||
|
|
||||||
export async function loadItunesAlbum(album) {
|
export async function loadItunesAlbum(album) {
|
||||||
try {
|
try {
|
||||||
const rawTracks = await itunesLookupAlbum(album.collectionId);
|
const tracks = await itunesLookupAlbum(album.collectionId);
|
||||||
const tracks = rawTracks.filter(t => !isExplicit(t));
|
|
||||||
if(!tracks.length) { toast('Keine Tracks gefunden'); return; }
|
if(!tracks.length) { toast('Keine Tracks gefunden'); return; }
|
||||||
const el = document.getElementById('global-search-results');
|
const el = document.getElementById('global-search-results');
|
||||||
const s = document.createElement('div'); s.className = 'search-section';
|
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, 'album', 20),
|
||||||
itunesSearch(artistName, 'musicTrack', 10),
|
itunesSearch(artistName, 'musicTrack', 10),
|
||||||
]);
|
]);
|
||||||
const artistAlbums = albums.filter(a => (a.artistId===artistId || a.artistName===artistName) && !isExplicit(a));
|
const artistAlbums = albums.filter(a => a.artistId===artistId || a.artistName===artistName);
|
||||||
const artistTracks = topTracks.filter(t => t.wrapperType==='track' && !isExplicit(t) && (t.artistId===artistId || t.artistName===artistName));
|
const artistTracks = topTracks.filter(t => t.wrapperType==='track' && (t.artistId===artistId || t.artistName===artistName));
|
||||||
const coverImg = artistAlbums[0]?.artworkUrl100?.replace('100x100','600x600') || '';
|
const coverImg = artistAlbums[0]?.artworkUrl100?.replace('100x100','600x600') || '';
|
||||||
el.innerHTML = '';
|
el.innerHTML = '';
|
||||||
|
|
||||||
@@ -797,16 +795,12 @@ async function loadItunesFallbackRecommendations(el, artist, title, html) {
|
|||||||
const sec = document.createElement('div');
|
const sec = document.createElement('div');
|
||||||
sec.innerHTML = `<div class="section-title" style="margin-bottom:10px">Mehr von ${esc(artist)}</div>`;
|
sec.innerHTML = `<div class="section-title" style="margin-bottom:10px">Mehr von ${esc(artist)}</div>`;
|
||||||
const list = document.createElement('div'); list.className = 'song-list';
|
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])));
|
results.filter(t => t.artistName===artist).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])));
|
if(!list.children.length) results.slice(0,15).forEach(t => list.appendChild(makeGlobalTrackItem(t, 0, [t])));
|
||||||
sec.appendChild(list); el.appendChild(sec);
|
sec.appendChild(list); el.appendChild(sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── HELPERS ───
|
// ─── HELPERS ───
|
||||||
function isExplicit(item) {
|
|
||||||
return item.trackExplicitness === 'explicit' || item.collectionExplicitness === 'explicit';
|
|
||||||
}
|
|
||||||
|
|
||||||
export function expandArtistBio() {
|
export function expandArtistBio() {
|
||||||
const el = document.getElementById('artist-bio-text');
|
const el = document.getElementById('artist-bio-text');
|
||||||
if(el && window._artistBioFull) el.textContent = window._artistBioFull;
|
if(el && window._artistBioFull) el.textContent = window._artistBioFull;
|
||||||
|
|||||||
Reference in new issue
Block a user