Use DownOnSpot to directly download from spotify server, and since it is command-line based it can be automated. Although you need to compile the binary yourself and some skill on using shell script. No idea if it can bypass region lock (maybe VPN will works?).
Huh interesting. Which source (or method) you did so I can find it myself? Or maybe the magnet name.