#!/bin/bash
#
# FLVGET Plugin for "ZippyVideos" version 1.1
# http://www.zippyvideos.com/
#
# This plugin is released under GPL free license.
#
# Pablo Chinea <khertz@gmail.com>
#################################################

if [[ $1 == '-q' ]]
then
	echo "FLVGET_PLUGIN|ZippyVideos|zippyvideos.com"
	exit 0
fi

data=$(wget -q "$1" -O - | grep embed | cut -d"'" -f2 | cut -d'?' -f2 | tr '&' '\n')
storageId=$(echo "$data" | grep storageId | cut -d'=' -f2)
userName=$(echo "$data" | grep userName | cut -d'=' -f2)
videoId=$(echo "$data" | grep videoId | cut -d'=' -f2)
srvURL=$(echo "$data" | grep srvURL | cut -d'=' -f2)

url="$srvURL/$storageId/$userName/$videoId"
filename=$(echo "$1" | cut -d'/' -f5).flv

echo "$url|$filename"

