mirror of
https://github.com/zhaarey/AppleMusicDecrypt.git
synced 2025-10-23 15:11:06 +00:00
add support to pulling explicit tag. fix tags on upc. isrc(mp4 not support, use WM tags), and composor missing(possible bug in mp4box, apple documents uses @wrt which belongs to writer in mp4box doc.)
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -161,3 +161,5 @@ cython_debug/
|
|||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
config.toml
|
config.toml
|
||||||
|
.python-version
|
||||||
|
.vscode/*
|
||||||
|
|||||||
@@ -73,10 +73,10 @@ afterDownloaded = ""
|
|||||||
# title, artist, album, album_artist, composer,
|
# title, artist, album, album_artist, composer,
|
||||||
# genre, created, track, tracknum, disk,
|
# genre, created, track, tracknum, disk,
|
||||||
# record_company, upc, isrc, copyright,
|
# record_company, upc, isrc, copyright,
|
||||||
# lyrics, cover
|
# lyrics, cover, ratings(rtng)
|
||||||
embedMetadata = ["title", "artist", "album", "album_artist", "composer",
|
embedMetadata = ["title", "artist", "album", "album_artist", "composer",
|
||||||
"genre", "created", "track", "tracknum", "disk", "lyrics", "cover", "copyright",
|
"genre", "created", "track", "tracknum", "disk", "lyrics", "cover", "copyright",
|
||||||
"record_company", "upc", "isrc"]
|
"record_company", "upc", "isrc","rtng"]
|
||||||
|
|
||||||
[mitm]
|
[mitm]
|
||||||
# The host proxy server listens on
|
# The host proxy server listens on
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ async def get_cover(url: str, cover_format: str, cover_size: str):
|
|||||||
async def get_song_info(song_id: str, token: str, storefront: str, lang: str):
|
async def get_song_info(song_id: str, token: str, storefront: str, lang: str):
|
||||||
async with request_lock:
|
async with request_lock:
|
||||||
req = await client.get(f"https://amp-api.music.apple.com/v1/catalog/{storefront}/songs/{song_id}",
|
req = await client.get(f"https://amp-api.music.apple.com/v1/catalog/{storefront}/songs/{song_id}",
|
||||||
params={"extend": "extendedAssetUrls", "include": "albums", "l": lang},
|
params={"extend": "extendedAssetUrls", "include": "albums,explicit", "l": lang},
|
||||||
headers={"Authorization": f"Bearer {token}", "User-Agent": user_agent_itunes,
|
headers={"Authorization": f"Bearer {token}", "User-Agent": user_agent_itunes,
|
||||||
"Origin": "https://music.apple.com"})
|
"Origin": "https://music.apple.com"})
|
||||||
song_data_obj = SongData.model_validate(req.json())
|
song_data_obj = SongData.model_validate(req.json())
|
||||||
|
|||||||
@@ -41,6 +41,12 @@ class SongMetadata(BaseModel):
|
|||||||
lrc = ttml_convent_to_lrc(value)
|
lrc = ttml_convent_to_lrc(value)
|
||||||
tags.append(f"{key}={lrc}")
|
tags.append(f"{key}={lrc}")
|
||||||
continue
|
continue
|
||||||
|
if key.lower() in ('upc', 'isrc'):
|
||||||
|
tags.append(f"WM/{key.lower()}={value}")
|
||||||
|
continue
|
||||||
|
if key == 'composer':
|
||||||
|
tags.append(f"writer={value}")
|
||||||
|
continue
|
||||||
tags.append(f"{key}={value}")
|
tags.append(f"{key}={value}")
|
||||||
return ":".join(tags)
|
return ":".join(tags)
|
||||||
|
|
||||||
@@ -55,7 +61,8 @@ class SongMetadata(BaseModel):
|
|||||||
copyright=song_data.relationships.albums.data[0].attributes.copyright,
|
copyright=song_data.relationships.albums.data[0].attributes.copyright,
|
||||||
record_company=song_data.relationships.albums.data[0].attributes.recordLabel,
|
record_company=song_data.relationships.albums.data[0].attributes.recordLabel,
|
||||||
upc=song_data.relationships.albums.data[0].attributes.upc,
|
upc=song_data.relationships.albums.data[0].attributes.upc,
|
||||||
isrc=song_data.attributes.isrc
|
isrc=song_data.attributes.isrc,
|
||||||
|
rtng=1 if song_data.attributes.contentRating and song_data.attributes.contentRating == 'explicit' else 0
|
||||||
)
|
)
|
||||||
|
|
||||||
def set_lyrics(self, lyrics: str):
|
def set_lyrics(self, lyrics: str):
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ class Attributes(BaseModel):
|
|||||||
previews: List[Preview]
|
previews: List[Preview]
|
||||||
artistName: Optional[str] = None
|
artistName: Optional[str] = None
|
||||||
extendedAssetUrls: ExtendedAssetUrls
|
extendedAssetUrls: ExtendedAssetUrls
|
||||||
|
contentRating: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
class Artwork1(BaseModel):
|
class Artwork1(BaseModel):
|
||||||
|
|||||||
Reference in New Issue
Block a user