Skip to content

Instantly share code, notes, and snippets.

@XMB5
Last active August 27, 2018 23:53
Show Gist options
  • Save XMB5/5d99883a7e118d097de81e2a26932846 to your computer and use it in GitHub Desktop.
Save XMB5/5d99883a7e118d097de81e2a26932846 to your computer and use it in GitHub Desktop.
Get the direct URL of a zippyshare download page
#!/bin/bash
#node, curl, awk, and gnu grep must be installed
SCRIPT=`curl "$1" -sL -H'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/68.0.3440.106 Chrome/68.0.3440.106 Safari/537.36' | grep -oP "document.getElementById\('dlbutton'\)\.href = \K.+?(?=;)"`
RELATIVE=`node -e "require=0;process=0;module=0;console.log($SCRIPT)"`
HOST=`echo "$1" | awk -F[/:] '{print $4}'`
echo "https://$HOST$RELATIVE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment