You should be able to use Audacity to record from Youtube, Spotify, or any other audio stream. Have a look at the options in the dropdown menu next to the microphone icon - you want one that includes "loopback", "what u hear" (sic), or "stereo mix". This treats your audio output as a microphone input, so you end up recording all sounds currently playing on your PC.
Start recording in Audacity, go to Youtube, play the video, wait for the song to end, stop recording, save.
As others have described, you can then do your looping, speed changing, pitchshifting, EQ, etc. in Audacity as well. Though personally I prefer Transcribe! for this part - it feels a lot less clunky.