howl-fm_download.js
· 342 B · JavaScript
Raw
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
| 1 | a = document.getElementsByTagName("a"); |
| 2 | out = ""; |
| 3 | for (var i=0;i<a.length;i++) { |
| 4 | if (a[i].hasAttribute("data-stream-url")) { |
| 5 | out = out + " '" + a[i].getAttribute("data-stream-url") + "'" |
| 6 | } |
| 7 | }; |
| 8 | prompt("urls:", out) |
| 9 | //then use that with something like wget. you'll get a bunch of long filenames. use the below script to fix the filenames |
howl-fm_renamer.py
· 252 B · Python
Raw
#!/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)
| 1 | #!/usr/bin/env python3 |
| 2 | from glob import glob |
| 3 | import os |
| 4 | from urllib.parse import unquote |
| 5 | for fn in glob("*.mp3?response-content-disposition*"): |
| 6 | newfn = unquote(unquote(fn.split("filename=%22")[1].split("%22")[0])) |
| 7 | os.rename(fn, newfn) |
| 8 | print(newfn) |