refactor: remove dead code from backend and lib
- Remove unused spotifyClientId/spotifyClientSecret from config - Remove AUDIO_EXTS from metadata exports (internal-only) - Remove tryYtdlp wrapper in ytdlp.js (direct spawnYtdlp calls) - Remove _spArtistName wrapper in server (direct _spAllArtists calls) - Fix stale comment: primary resolver is SpotipyFree, not curl_cffi Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
c36dbb3c94
commit
0f1e6ff531
4 files changed
+14
-22
No files matched your search
@@ -296,10 +296,6 @@ function _spAllArtists(artistsRaw) {
|
||||
return arr.map(a => a?.profile?.name || a?.name || '').filter(Boolean).join(', ');
|
||||
}
|
||||
|
||||
function _spArtistName(artistsRaw) {
|
||||
return _spAllArtists(artistsRaw);
|
||||
}
|
||||
|
||||
function _spTrackItem(t, defaultAlbum, defaultArt, defaultAlbumArtist) {
|
||||
const trackName = t?.name || '';
|
||||
const artist = _spAllArtists(t?.artists) || defaultAlbumArtist || '';
|
||||
@@ -377,7 +373,7 @@ async function _resolveSpotifyViaSpotdl(url) {
|
||||
}
|
||||
|
||||
async function _resolveSpotify(type, id, originalUrl) {
|
||||
// Primary: curl_cffi Chrome-impersonation + TOTP (no rate limit bucket as api keys)
|
||||
// Primary: SpotipyFree (SpotAPI + tls_client Chrome fingerprint, Spotify internal endpoints)
|
||||
try {
|
||||
console.log('[spotify] trying spotdl resolver');
|
||||
return await _resolveSpotifyViaSpotdl(originalUrl);
|
||||
@@ -391,7 +387,7 @@ async function _resolveSpotify(type, id, originalUrl) {
|
||||
|
||||
if (type === 'track') {
|
||||
const t = await _spApi(`/tracks/${id}`, token);
|
||||
const artist = _spArtistName(t.artists);
|
||||
const artist = _spAllArtists(t.artists);
|
||||
const artUrl = _spArtwork(t);
|
||||
return { type: 'track', name: t.name || '', artist, artworkUrl: artUrl,
|
||||
tracks: [_spTrackItem(t, t.album?.name, artUrl, artist)] };
|
||||
@@ -399,7 +395,7 @@ async function _resolveSpotify(type, id, originalUrl) {
|
||||
|
||||
if (type === 'album') {
|
||||
const album = await _spApi(`/albums/${id}`, token);
|
||||
const artist = _spArtistName(album.artists);
|
||||
const artist = _spAllArtists(album.artists);
|
||||
const artUrl = _spArtwork(album);
|
||||
const trackItems = await _spAllAlbumTracks(id, token);
|
||||
return { type: 'album', name: album.name || '', artist, artworkUrl: artUrl,
|
||||
|
||||
Reference in new issue
Block a user