Skip to content

Instantly share code, notes, and snippets.

@blha303
Last active June 10, 2017 17:06
Show Gist options
  • Save blha303/7819440a820f865911d8de92d599e067 to your computer and use it in GitHub Desktop.
Save blha303/7819440a820f865911d8de92d599e067 to your computer and use it in GitHub Desktop.
howl.fm playlist downloader. I just don't like paywalls, sorry
a = document.getElementsByTagName("a");
out = "";
for (var i=0;i<a.length;i++) {
if (a[i].hasAttribute("data-stream-url")) {
out = out + " '" + a[i].getAttribute("data-stream-url") + "'"
}
};
prompt("urls:", out)
//then use that with something like wget. you'll get a bunch of long filenames. use the below script to fix the filenames
#!/usr/bin/env python3
from glob import glob
import os
from urllib.parse import unquote
for fn in glob("*.mp3?response-content-disposition*"):
newfn = unquote(unquote(fn.split("filename=%22")[1].split("%22")[0]))
os.rename(fn, newfn)
print(newfn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment