Skip to content

Instantly share code, notes, and snippets.

@poying
Last active November 27, 2015 16:46
Embed
What would you like to do?
#!/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