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

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

#url=$(wget -q -O - "$1" | grep embed | sed -e's/^.*\(http.*\....\).*$/\1/')
url=$(wget -q -O - "$1" | grep '"movie"' | cut -d'"' -f4 | tr '&' '\n'| grep videoembed_id | cut -d'=' -f2 | sed -e 's/%3A/:/g' -e 's/%2F/\//g' -e 's/%3F/\?/' -e 's/%3D/=/g' -e 's/%26/\&/g')
filename=$(echo $1 | sed -e 's/.*file=\(.*\)\..*/\1/').flv

echo "$url|$filename"

