Permalink
Browse files

* newgrounds.com: add rate limiter to avoid ban

  • Loading branch information...
l29ah committed Oct 26, 2017
1 parent deb05d6 commit 0c2bc6e992ce7cce5dc28aa81e1bf8fcafa4fa26
Showing with 7 additions and 2 deletions.
  1. +7 −2 newgrounds.com/newgrounds-audio
@@ -1,7 +1,12 @@
#!/bin/sh
#!/bin/bash
# Usage: $0 https://waterflame.newgrounds.com/audio/
for u in $(curl -s "$1" | sed -n -e 's,.*<a href="\([^"]*/\)listen\(/[^"]*\)".*,https:\1download\2,p'); do
relu="$(curl -v "$u" 2>&1 | sed -ne 's,.*location: \(https.*\),\1,p')"
while [[ -z "$relu" ]]; do
echo Downloading too fast, waiting... >&2
sleep 30
relu="$(curl -v "$u" 2>&1 | sed -ne 's,.*location: \(https.*\),\1,p')"
done
fn="$(echo "$relu" | cut -d / -f 5- | cut -d \? -f 1)"
wget "$relu" -O "$fn"
wget -c "$relu" -O "$fn"
done

0 comments on commit 0c2bc6e

Please sign in to comment.