#!/bin/bash
headOut()
{
animeIn=$(echo "$QUERY_STRING" | sed -n 's/^.*anime=\([^&]*\).*$/\1/p')
touch ../tmp/tmpShow ../tmp/animeShow ../tmp/tmpVdoPg
wget http://www.theanimenetwork.com/Watch-Anime/"${animeIn}" -O ../tmp/tmpShow
sed 1,195d ../tmp/tmpShow > ../tmp/animeShow
IFS=$'\n'
bgs=($(ls -L ../backgrounds/))
numdirs=${#bgs[@]}
index=$(( (( RANDOM % $numdirs ) - 2) + 1 ))
if [ -f ./000.jpg ]; then
bg="
";
else
bg="";
fi
echo '
MiniRoll App
'${bg}'
' > ../tmp/list.html
main
}
main()
{
sed -n 's/.*title="\([^"]*\).*/\1/p' ../tmp/animeShow > ../tmp/tmptitles
sed -i '/Spoilers!!!/d' ../tmp/tmptitles
sed -i '/You must be a premium subscriber to watch this video./d' ../tmp/tmptitles
sed -i '/The Add To Queue feature is available to premium subscribers./d' ../tmp/tmptitles
sed -i '/^\s*$/d' ../tmp/tmptitles
awk 'NR%2==1' ../tmp/tmptitles > ../tmp/titles
sed -n 's/.*src="\([^"]*\).*/\1/p' ../tmp/animeShow > ../tmp/imgList
awk 'NR%2==1' ../tmp/imgList > ../tmp/tmpImgList
head -n -3 ../tmp/tmpImgList > ../tmp/imgList
sed -n 's/.*href="\([^"]*\).*/\1/p' ../tmp/animeShow > ../tmp/mediaIds
sed -i '/\/xx/d' ../tmp/mediaIds
awk 'NR%2==1' ../tmp/mediaIds > ../tmp/tmpIds
head -n -3 ../tmp/tmpIds > ../tmp/mediaIds
d=$(cat ../tmp/mediaIds | wc -l) >> /dev/null ;
i="1"
# World-God-Only-Knows-The-Season-1
# Log-Horizon
echo "" > ../tmp/tmpIds
echo "" > ../tmp/tmpIds2
while [ $i -le $d ]; do
meiaID=$(sed -n "${i}p" ../tmp/mediaIds);
wget http://www.theanimenetwork.com"${meiaID}" -O ../tmp/tmpVdoPg
sed -n 146,152p ../tmp/tmpVdoPg > ../tmp/tmpIds
sed -n 's/.*src="\([^"]*\).*/\1/p' ../tmp/tmpIds >> ../tmp/tmpIds2
i=$[$i++1];
done
sed -i '/^\s*$/d' ../tmp/tmpIds2
cat ../tmp/tmpIds2 > ../tmp/mediaIds
i="1"
while [ $i -le $d ]; do
title=$(sed -n "${i}p" ../tmp/titles);
imgLnk=$(sed -n "${i}p" ../tmp/imgList)
meiaID=$(sed -n "${i}p" ../tmp/mediaIds);
vdoLnk=""$meiaID""
echo '
' >> ../tmp/list.html ;
i=$[$i++1];
done
endOut
}
endOut()
{
echo '
' >> ../tmp/list.html
redirect
}
redirect()
{
echo "Content-type: text/html"
echo ""
echo ""
echo ""
echo "Loading..."
echo ""
echo ""
echo ""
echo "You will be redirected in a few seconds..."
echo ""
echo ""
echo ""
}
headOut