Skip to content

Instantly share code, notes, and snippets.

@poying
Last active November 27, 2015 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poying/6af811accce4693cf102 to your computer and use it in GitHub Desktop.
Save poying/6af811accce4693cf102 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Requirements:
# Node.js, curl, sed, grep
# Usage:
# ./putlocker.sh <video_url> <quality> <filename>
showjs="/tmp/show.js"
if [ ! -f "$showjs" ]; then
echo "Download decode script"
curl -s -o "$showjs" http://image3.putlocker.is/show.js
echo ";console.log(doit(process.argv[2]));" >> "$showjs"
fi
echo "Find embed url"
results=($(curl -s $1 | tr '\n' ' ' | grep -oE 'doit\(.*?\)' | sed -E "s/.*\('(.*)'\).*/\1/"))
iframeUrl=$(node "$showjs" "${results[1]}" | sed 's/.*src="\([^"]*\)".*/\1/')
echo "Find video url"
videoUrl=$(curl -s "$iframeUrl" | tr '\n' ' ' | grep 'label' | grep $2 | sed 's/.*file:"\([^"]*\).*/\1/')
echo "Download video"
curl -o $3 "$videoUrl"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment