Guide: How to download Spotify podcast videos

by u/stabbedbybrick and u/nekrovski

This guide is written from a Windows perspective, but all modern systems are supported.

Note: Some podcasts are DRM protected, some are not. I used Joe Rogan podcast for this guide, which is unprotected. This guide works for either, but you’ll need decryption keys for encrypted media. Obtaining those isn’t a part of this guide. See FAQ at the bottom for how to tell if it’s encrypted or not.


Requirements

  • Spotify account. Free or premium, doesn’t matter.
  • A command line or terminal with cURL. It comes with all modern systems.
  • Web browser with Developer tools. Usually reached with F12 or Ctrl + Shift + I.
  • A text editor. Notepad++ is recommended, but it doesn’t matter.
  • FFmpeg: LINK. Unpack and put ffmpeg.exe in the folder you plan to download from.
  • Shaka packager: LINK. Only needed if files are DRM protected and you have a key.
  • Ability to Copy/Paste. (Pro Tip: Win key + v activates clipboard history up to 25 entries.)

Instructions:

  • Start by saving this template to a file. It’s prepared with commands and comments. Refer to it while reading this guide.
  • Now open command prompt from your planned download folder by typing cmd in the folder address bar.
  • Log in to Spotify web player and find a podcast. Don’t play it yet.
  • Fire up Dev Tools and navigate to the Network tab. In the little box that says Filter, type in webm.
  • Play the podcast for a few seconds until you see several pairs of .webm files in the window, and hit pause. These webm files are segments containing stream info, with the first of each pair being audio while the second is video. There are 4 webm files that have no number. These are “init” files, and are basically used to tell all the other segments how to behave.

Screenshot

  • These init files consist of 1 for audio and 3 for video, and are always served in order of quality, from worst to best.
  • Right-click on the first init and copy the link address. Paste this in the “URL” placeholder in the first command where it says “audio init”. Now do the same for the second init, and put it under “video init”.
    curl -s "URL to audio init" -o inita.webm
    curl -s "URL to video init" -o initb.webm
  • After running those commands, you should have the init files in your folder. In your paused video, drag the slider all the way to the end until you see the last pair of webm files. Copy the addresses of both and paste it in notepad or similar. In those addresses, you will see this part: /profiles/23/11060.webm (numbers will be specific to your podcast).
  • Edit that part of the addresses to look like this:
    … /profiles/23/[0-11060:4].webm... (replace 23 & 11060 with your values)
    … /profiles/19/[0-11060:4].webm... (replace 19 & 11060 with your values)
  • Your two commands should look like this:
    curl -s "https://url.../profiles/23/[0-11060:4].webm?...url" > audio_tmp.webm curl -s "https://url.../profiles/19/[0-11060:4].webm?...url" > video_tmp.webm
  • This is where all segments will be fed into two webm files in your folder. One for audio and one for video. Don’t worry if the console is blank with nothing but a blinking cursor. That is made on purpose with the -s making things “silent”. Just sit back and relax.
  • When those downloads are finished, it’s time to join them with their init files using the Type cmd:
    type inita.webm audio_tmp.webm > audio.webm
    type initb.webm video_tmp.webm > video.webm
  • This is where you use Shaka packager if needed:
    packager in=video.webm,stream=video,output=video_dec.webm --enable_raw_key_decryption --keys key_id=KID:key=KEY packager in=audio.webm,stream=audio,output=audio_dec.webm --enable_raw_key_decryption --keys key_id=KID:key=KEY
  • And finally it’s time to merge the audio and video together with ffmpeg (choose preferred container):
    ffmpeg -hide_banner -i video.webm -i audio.webm -c copy final_title.mkv
  • And clean up the folder if you want:
    del /f audio.webm video.webm audio_tmp.webm video_tmp.webm inita.webm initb.webm

Well done! You should now have a 1080p video with synced audio in your folder.
Mediainfo: https://pastebin.com/raw/uVqZz3k7


FAQs

Q: What does [0-9999:4] do?
A: That’s the key to this whole thing! Normally, a playlist or manifest file of some kind is available from which you can pull all these segments. But Spotify is being tricky and has hidden it really well, and is serving us these teeny tiny pieces of files in real time. Which means it would normally take as long as the podcast to get all the segments. But if we look at the URLs, we can see that they never change, except for an incremental segment value of 4. So, by adding a range ([0-9999]) with the values of the first and last segments, and only grabbing every fourth value (:4) in between those, we can actually anticipate the addresses and cURL these bad boys before they’re being served in the browser.

Q: I ran the command but nothing is happening! The cursor is just blinking.
A: That means it’s working! The -s stands for Silent, and removes all output from the console. Curling displays many, many rows of data and can actually slow everything down. Be patient and trust the process.

Q: How do I know if my podcast is DRM protected before downloading?

A: Filter for “license” in Dev Tools when playing the video. If it comes up empty, it’s not protected. If you find an entry, it means that the media is protected by Widevine.

Q: Can I download a section of a video?

A: Yes. Adjust the segments in [0-9999:4] to fit your needs.

Q: I’m not “tech-savvy” enough for this. Isn’t there a button I can push or something?

A: Someone can probably write a program for it. But it won't be me.

Edit
Pub: 15 Apr 2024 17:44 UTC
Edit: 15 Apr 2024 17:54 UTC
Views: 300