This is where ChatGPT shines. Just ask it to write you a script, it'll give you all the instructions.
I've used ChatGPT to write a whole bunch of playlist logic scripts (e.g. create a playlist that takes tracks from playlists A, B and C, but exclude tracks in playlist D.)
You can also do this with your human brain, which doesn't require 1 MWh or a thousand gallons of water to write a script to pipe API results to jq.
I worry about potential bans from scraping files through this sort of thing.
No files are involved. It's about backing up the metadata -- your playlists, liked songs.
So you can recreate the playlists on another Spotify account or another music service.