While migrating from iTunes on one machine to Apple Music on another one, I needed to migrate part of the (disorganised) playlists.
I knew there was a binary ~/Music/iTunes/iTunes Library.itl file, but that is encoded or encrypted, making it hard to parse.
Luckily there is also ~/Music/iTunes/iTunes Music Library.xml which I found via the links below.
- [Wayback/Archive] What file holds my itunes playlists – Apple Community
- [Wayback/Archive] How to extract playlists (list of file locations) from iTunes using python – Stack Overflow
The iTunes library xml file is in the same directory as the .itl file. The file is in Apple plist format, and Python’s standard library has a good parser for it.





