# \[WS\] Apple Music

**URL:** <https://community.mp3tag.de/t/ws-apple-music/51184>\
**Category:** Web Sources Scripts\
**Created:** [December 14, 2020, 12:58am UTC](https://community.mp3tag.de/t/ws-apple-music/51184 "2020-12-14T00:58:26Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)\
**Post date:** [April 22, 2021, 12:53pm UTC](https://community.mp3tag.de/t/ws-apple-music/51184/44 "2021-04-22T12:53:58Z")

</div>

@AreDigg

I would like to modify your Apple script so that only the COMPOSER tag field is filled.  
With this it would be possible to add the previously missing COMPOSER tag field to my already tagged music inventory without touching existing tag fields.

Since I only have rudimentary knowledge of scripts, I get stuck at one point.  
In order to change your script as little as possible, I wanted to reset the unwanted tag fields at the end of the script, e.g.  
set "albumartist"  
set "album"  
.....

The problem seems to be TRACKS.  
When I reset TRACKS the number of tracks in the left Windows (Websource) is based solely on the number of files in the right field (files marked in MP3Tag).  
If Apple has more tracks in the album, they will not be listed.  
If the album-websource contains fewer tracks, additional fields are displayed that contain the COMPOSER more than once.

When I don't reset TRACKS, in addition to the COMPOSER field, TRACK, TITLE.and LENGTH are also displayed.

It would be ideal for me if only COMPOSER and LENGTH were displayed, whereby LENGTH could serve as a guide for the correctness of the display and otherwise would not be a problem, since it is not written in a tag field.

As you can see, I don't really understand the script in all points.  
Can you give me the decisive tip?

---

<div class="post-metadata">

**Author:** ![AreDigg](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/bbe5ce/32.png) [@AreDigg](https://community.mp3tag.de/u/AreDigg)\
**Post date:** [April 22, 2021, 9:11pm UTC](https://community.mp3tag.de/t/ws-apple-music/51184/45 "2021-04-22T21:11:05Z")

</div>

> [@poster](#):
>
> As you can see, I don't really understand the script in all points.  
> Can you give me the decisive tip?

I am not sure where you fail, but you need to ensure there are enough data for each track. I haven't looked into the details of the scripting system, if some fields are required. You would have to ask Florian if there are any quirks about that.

---

<div class="post-metadata">

**Author:** ![RunninThruThe6](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/ecd19e/32.png) [@RunninThruThe6](https://community.mp3tag.de/u/RunninThruThe6)\
**Post date:** [April 23, 2021, 1:33am UTC](https://community.mp3tag.de/t/ws-apple-music/51184/46 "2021-04-23T01:33:28Z")

</div>

@AreDigg

I have a question about something in your Apple Music script.

```
json_select_object "artists"
    json_select_many "data" "id" ", "
    OutputTo "ITUNESARTISTID"
    IfNot ""
        SayRest
    EndIf
    Say "|"
json_unselect_object

```

This code above in your script will get every artist ID when there is more than one artist for a song. Do you know how to change this code so that it will only get the first artist ID?

---

<div class="post-metadata">

**Author:** ![RunninThruThe6](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/ecd19e/32.png) [@RunninThruThe6](https://community.mp3tag.de/u/RunninThruThe6)\
**Post date:** [April 25, 2021, 10:37pm UTC](https://community.mp3tag.de/t/ws-apple-music/51184/47 "2021-04-25T22:37:49Z")

</div>

I found an Apple Music script that only gets the first artist ID.

> **[MrBukLau/mp3tag-web-sources-scripts](https://github.com/MrBukLau/mp3tag-web-sources-scripts)**
>
> Apple Music and iTunes Store Web Sources Scripts for Mp3tag

---

<div class="post-metadata">

**Author:** ![RunninThruThe6](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/ecd19e/32.png) [@RunninThruThe6](https://community.mp3tag.de/u/RunninThruThe6)\
**Post date:** [April 26, 2021, 9:03pm UTC](https://community.mp3tag.de/t/ws-apple-music/51184/48 "2021-04-26T21:03:45Z")

</div>

@AreDigg

Not sure if it's just me, but the Apple Music script doesn't work anymore as of today. It doesn't bring up any data after searching for a song.

---

<div class="post-metadata">

**Author:** ![taggert](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@taggert](https://community.mp3tag.de/u/taggert)\
**Post date:** [April 27, 2021, 12:04am UTC](https://community.mp3tag.de/t/ws-apple-music/51184/49 "2021-04-27T00:04:27Z")

</div>

it's not just you. I've been seeing the same thing. It worked fine just this morning. I'm hoping it's just a short term issue on Apple's side...

---

<div class="post-metadata">

**Author:** ![AreDigg](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/bbe5ce/32.png) [@AreDigg](https://community.mp3tag.de/u/AreDigg)\
**Post date:** [April 27, 2021, 2:41am UTC](https://community.mp3tag.de/t/ws-apple-music/51184/50 "2021-04-27T02:41:51Z")

</div>

Apple changed somethings but should work with this version.

[Apple Music for Mp3Tag 1.7.zip](https://community.mp3tag.de/uploads/short-url/tV0EGCyyqWrw5LZpC4LZCcpq6HG.zip) (33.2 KB)

---

<div class="post-metadata">

**Author:** ![AreDigg](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/bbe5ce/32.png) [@AreDigg](https://community.mp3tag.de/u/AreDigg)\
**Post date:** [April 27, 2021, 2:54am UTC](https://community.mp3tag.de/t/ws-apple-music/51184/51 "2021-04-27T02:54:13Z")

</div>

> [@RunninThruThe6](#):
>
> @AreDigg
> 
> I have a question about something in your Apple Music script.
> 
> ```
> json_select_object "artists"
> json_select_many "data" "id" ", "
> OutputTo "ITUNESARTISTID"
> IfNot ""
> SayRest
> EndIf
> Say "|"
> json_unselect_object
> 
> ```
> 
> This code above in your script will get every artist ID when there is more than one artist for a song. Do you know how to change this code so that it will only get the first artist ID?

If you change that part of the script to

```
json_select_object "artists"
    json_select_object "data"
        json_select_array "id" 1
        OutputTo "ITUNESARTISTID"
        IfNot ""
            SayRest
        EndIf
        Say "|"
    json_unselect_object
json_unselect_object

```

it should only give you the first id.

---

<div class="post-metadata">

**Author:** ![AreDigg](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/bbe5ce/32.png) [@AreDigg](https://community.mp3tag.de/u/AreDigg)\
**Post date:** [April 27, 2021, 2:56am UTC](https://community.mp3tag.de/t/ws-apple-music/51184/52 "2021-04-27T02:56:42Z")

</div>

> [@RunninThruThe6](#):
>
> I found an Apple Music script that only gets the first artist ID.

Interesting. He took my script and modified it. I would have appreciated if he asked before.

---

<div class="post-metadata">

**Author:** ![RunninThruThe6](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/ecd19e/32.png) [@RunninThruThe6](https://community.mp3tag.de/u/RunninThruThe6)\
**Post date:** [April 28, 2021, 6:17pm UTC](https://community.mp3tag.de/t/ws-apple-music/51184/53 "2021-04-28T18:17:53Z")

</div>

> [@AreDigg](#):
>
> If you change that part of the script to
> 
> ```
> json_select_object "artists"
> json_select_object "data"
> json_select_array "id" 1
> OutputTo "ITUNESARTISTID"
> IfNot ""
> SayRest
> EndIf
> Say "|"
> json_unselect_object
> json_unselect_object
> 
> ```
> 
> it should only give you the first id.

I changed it to that, but it didn't work. It didn't output any artist ID.

---

<div class="post-metadata">

**Author:** ![AreDigg](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/bbe5ce/32.png) [@AreDigg](https://community.mp3tag.de/u/AreDigg)\
**Post date:** [April 29, 2021, 11:19pm UTC](https://community.mp3tag.de/t/ws-apple-music/51184/54 "2021-04-29T23:19:14Z")

</div>

> [@RunninThruThe6](#):
>
> I changed it to that, but it didn't work. It didn't output any artist ID.

I guess that's happening when you write something and not testing it, try this:

```
json_select_object "artists"
    json_select_array "data" 1
        json_select "id"
        OutputTo "ITUNESARTISTID"
        IfNot ""
            SayRest
        EndIf
        Say "|"
json_unselect_object

```

Anyway a new version  
[Apple Music for Mp3Tag 1.9.zip](https://community.mp3tag.de/uploads/short-url/gteSEQeoZXilU5p0d6UGP1EWmve.zip) (34.3 KB)

---

<div class="post-metadata">

**Author:** ![chipotle](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/47e85d/32.png) [@chipotle](https://community.mp3tag.de/u/chipotle)\
**Post date:** [April 30, 2021, 3:09am UTC](https://community.mp3tag.de/t/ws-apple-music/51184/55 "2021-04-30T03:09:24Z")

</div>

Hi AreDigg.  
I know you've been improving your script with every new version, I was using the v1.5 and it work so good 'til just show up nothing, then I updated and no more problems. I really like (love) having my library well tagged. And since I found your scripts my life is so easy now, BUT, as I said in the beggining, every time the script stops working its because Apple changes something? And i'm afraid you're gonna get tired of updating so frecuently, and this is a TIME-SAVER for me, I can tagg my files by myself to make it looks like if your scrpit was using in the following terms:  
Me: 15-20 minutes - per album  
WS Apple Music: 1 minute per album

An finally I really like to give a Big thank You 😚

Saludos desde 🇦🇷

---

<div class="post-metadata">

**Author:** ![AreDigg](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/bbe5ce/32.png) [@AreDigg](https://community.mp3tag.de/u/AreDigg)\
**Post date:** [April 30, 2021, 11:50am UTC](https://community.mp3tag.de/t/ws-apple-music/51184/56 "2021-04-30T11:50:05Z")

</div>

> [@chipotle](#):
>
> And since I found your scripts my life is so easy now, BUT, as I said in the beggining, every time the script stops working its because Apple changes something?

Thanks for kind words.

Yes they stop working because Apple changes things. And there is the risk that Apple will change stuff so it will not be able to work. This is not official way to access Apple Music database, as to access it officially you will need to do it with the developer id and preferably in a way to promote/offer Apple Music, or for customers of Apple Music. I will keep updating it as I use it myself, and for now the changes required are usually minor and anyone with some programming skills should be able to make them work. It could also be possible to make it more resilient to the changes, but for now it is easier to just modify the script.

---

<div class="post-metadata">

**Author:** ![RunninThruThe6](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/ecd19e/32.png) [@RunninThruThe6](https://community.mp3tag.de/u/RunninThruThe6)\
**Post date:** [April 30, 2021, 10:29pm UTC](https://community.mp3tag.de/t/ws-apple-music/51184/57 "2021-04-30T22:29:07Z")

</div>

> [@AreDigg](#):
>
> ```
> json_select_object "artists"
> json_select_array "data" 1
> json_select "id"
> OutputTo "ITUNESARTISTID"
> IfNot ""
> SayRest
> EndIf
> Say "|"
> json_unselect_object
> 
> ```

This worked. Thank you!

---

<div class="post-metadata">

**Author:** ![taggert](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@taggert](https://community.mp3tag.de/u/taggert)\
**Post date:** [April 30, 2021, 10:36pm UTC](https://community.mp3tag.de/t/ws-apple-music/51184/58 "2021-04-30T22:36:16Z")

</div>

Hi AreDigg,

I'm wondering if it would be possible to break out the data scrub into a separate inc file (assuming it's the data scrub portion of the script that apple keeps breaking)? Taking that approach would allow users that are tweaking the search and naming portions of your scripts to meet our specific needs to leave our changes intact when updates are necessary. Just a thought.

Thanks for sharing this script by the way - It's helped fill all kinds of gaps in my metadata.

---

<div class="post-metadata">

**Author:** ![AreDigg](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/bbe5ce/32.png) [@AreDigg](https://community.mp3tag.de/u/AreDigg)\
**Post date:** [May 1, 2021, 1:14am UTC](https://community.mp3tag.de/t/ws-apple-music/51184/59 "2021-05-01T01:14:51Z")

</div>

> [@taggert](#):
>
> I'm wondering if it would be possible to break out the data scrub into a separate inc file (assuming it's the data scrub portion of the script that apple keeps breaking)?

It is not so complicated that should be necessary.

What is breaking is the top level of the json, as it seem to be constructed of what is likely an internal query string into the database. In a way it has been somewhat beneficial when it breaks, as Apple has added more data onto the query every time, and thus returning more.

---

<div class="post-metadata">

**Author:** ![taggert](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@taggert](https://community.mp3tag.de/u/taggert)\
**Post date:** [May 1, 2021, 10:25pm UTC](https://community.mp3tag.de/t/ws-apple-music/51184/60 "2021-05-01T22:25:13Z")

</div>

Fair enough. The potential for some additional data is a unexpected bonus for sure!

Thanks

---

<div class="post-metadata">

**Author:** ![mp3taguser](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/82dd89/32.png) [@mp3taguser](https://community.mp3tag.de/u/mp3taguser)\
**Post date:** [May 2, 2021, 9:00pm UTC](https://community.mp3tag.de/t/ws-apple-music/51184/61 "2021-05-02T21:00:19Z")

</div>

Not sure if this has been checked out, but is it possible to have this apply the itunesadvisory field?

---

<div class="post-metadata">

**Author:** ![AreDigg](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/bbe5ce/32.png) [@AreDigg](https://community.mp3tag.de/u/AreDigg)\
**Post date:** [May 3, 2021, 2:58am UTC](https://community.mp3tag.de/t/ws-apple-music/51184/62 "2021-05-03T02:58:23Z")

</div>

A little update. I have added so it picks up music videos if they exist on the albums. A few bug fixes and minor changes.

[Apple Music for Mp3Tag 2.0.zip](https://community.mp3tag.de/uploads/short-url/xqIb1FydM4yPT1CsuAQnmtbjmdi.zip) (34.8 KB)

---

<div class="post-metadata">

**Author:** ![Ouargui](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/o/f17d59/32.png) [@Ouargui](https://community.mp3tag.de/u/Ouargui)\
**Post date:** [May 3, 2021, 3:54am UTC](https://community.mp3tag.de/t/ws-apple-music/51184/63 "2021-05-03T03:54:36Z")

</div>

Nice update, and since we're talking ab music videos, apple script provides mv thumbnails seprately from the album cover, is there a way to import multiple covers at once ?

[Previous page](https://community.mp3tag.de/t/ws-apple-music/51184.md?page=2)

[Next page](https://community.mp3tag.de/t/ws-apple-music/51184.md?page=4)
