[37524] | 1 | #!/bin/bash |
---|
| 2 | # box parser for titannit |
---|
| 3 | |
---|
[39612] | 4 | . /tmp/localhoster/hoster.sh |
---|
| 5 | |
---|
[37524] | 6 | SRC=$1 |
---|
| 7 | INPUT=$2 |
---|
| 8 | PARAM=$3 |
---|
| 9 | PAGE=$4 |
---|
[39612] | 10 | |
---|
[37524] | 11 | URL="http://kkiste.to/" |
---|
| 12 | PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'` |
---|
| 13 | NAME=`echo -n ${PARSER:0:2} | tr '[a-z]' '[A-Z]'`${PARSER:2} |
---|
| 14 | |
---|
| 15 | rm -rf $TMP > /dev/null 2>&1 |
---|
| 16 | mkdir $TMP > /dev/null 2>&1 |
---|
| 17 | |
---|
| 18 | if [ `echo $SRC | grep ^"/mnt/parser" |wc -l` -gt 0 ];then |
---|
| 19 | TYPE="$SRC - Shell script" |
---|
| 20 | elif [ `echo $SRC | grep ^"/var/swap" | wc -l` -gt 0 ];then |
---|
| 21 | TYPE="Swap - Shell script" |
---|
| 22 | elif [ `echo $SRC | grep ^"/mnt/swapextensions" | wc -l` -gt 0 ];then |
---|
| 23 | TYPE="Mnt - Shell script" |
---|
| 24 | else |
---|
| 25 | TYPE="Flash - Shell script" |
---|
| 26 | fi |
---|
| 27 | |
---|
| 28 | init() |
---|
| 29 | { |
---|
| 30 | echo "$NAME ($TYPE)#$SRC $SRC mainmenu#http://atemio.dyndns.tv/mediathek/menu/$PARSER.jpg#$PARSER.jpg#TiThek#0" |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | mainmenu() |
---|
| 34 | { |
---|
[39612] | 35 | echo "Neue Filme#$SRC $SRC videos neue-filme/?page= 1#http://atemio.dyndns.tv/mediathek/menu/all-newfirst.jpg#all-newfirst.jpg#$NAME#0" >$TMP/$PARSER.$INPUT.list |
---|
| 36 | echo "Kinofilme#$SRC $SRC videos aktuelle-kinofilme/?page= 1#http://atemio.dyndns.tv/mediathek/menu/all-newfirst.jpg#all-newfirst.jpg#$NAME#0" >>$TMP/$PARSER.$INPUT.list |
---|
| 37 | echo "Search#$SRC $SRC search 'search/?q=%search%'#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#$NAME#112" >>$TMP/$PARSER.$INPUT.list |
---|
| 38 | echo "$TMP/$PARSER.$INPUT.list" |
---|
[37524] | 39 | } |
---|
| 40 | |
---|
[39612] | 41 | search() |
---|
| 42 | { |
---|
| 43 | rm $TMP/$PARSER.$INPUT.list > /dev/null 2>&1 |
---|
| 44 | if [ -e "$TMP/$PARSER.$INPUT.list" ] ; then |
---|
| 45 | rm $TMP/$PARSER.$INPUT.list |
---|
| 46 | fi |
---|
| 47 | |
---|
| 48 | piccount=0 |
---|
| 49 | $curlbin "$URL/$PARAM" -o "$TMP/cache.$PARSER.$INPUT.1" |
---|
| 50 | cat $TMP/cache.$PARSER.$INPUT.1 | tr '\n' '\r' | tr '\r' ' ' | tr '\n' ' ' | tr '\t' ' ' | sed 's/ \+/ /g' | sed 's!<li class="mbox list"!\nfound=!g' | sed 's!<div class="clear">!\n<div class="clear">!g' | grep ^"found=" >$TMP/cache.$PARSER.$INPUT.2 |
---|
| 51 | |
---|
| 52 | while read -u 3 ROUND; do |
---|
| 53 | ID=`echo $ROUND | cut -d'"' -f1 | tail -n1` |
---|
| 54 | PIC=`echo $ROUND | sed 's!"url": !\nurl=!g' | grep ^url= | cut -d'"' -f2 | tail -n1` |
---|
| 55 | TITLE=`echo $ROUND | sed 's!class="title">!\ntitle=<!g' | grep ^title= | cut -d'<' -f2` |
---|
| 56 | NEWPAGE=`echo $ROUND | sed 's!<a href=!\nfound=!g' | grep ^found= | cut -d'"' -f2 | tail -n1` |
---|
| 57 | |
---|
| 58 | PIC=`$curlbin "$URL/$NEWPAGE" | tr '\n' '\r' | tr '\r' ' ' | tr '\n' ' ' | tr '\t' ' ' | sed 's/ \+/ /g' | sed 's!<img src=!\nfound=!g' | grep ^found= | cut -d'"' -f2 | tail -n1` |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | if [ -z "$PIC" ]; then |
---|
| 62 | PIC="http://atemio.dyndns.tv/mediathek/menu/default.jpg" |
---|
| 63 | fi |
---|
| 64 | |
---|
| 65 | TITLE=`echo $TITLE | sed -e 's/&/&/g' -e 's/&/und/g' -e 's/"/"/g' -e 's/</\</g' -e 's/"/\"/g' -e 's/'/\"/g' -e 's/#034;/\"/g' -e 's/#039;/\"/g' -e 's/ß/Ãx/g' -e 's/–/-/g' -e 's/Ä/Ã/g' -e 's/Ü/ÃS/g' -e 's/Ö/Ã/g' -e 's/ä/ä/g' -e 's/ü/ü/g' -e 's/ö/ö/g' -e 's/é/é/g' -e 's/è/è/g' -e 's/%F6/ö/g' -e 's/%FC/ü/g' -e 's/%E4/ä/g' -e 's/%26/&/g' -e 's/%C4/Ã/g' -e 's/%D6/Ã/g' -e 's/%DC/ÃS/g' -e 's/%28/(/g' -e 's/%29/)/g' -e 's/%3A/:/g' -e 's/%40/@/g' -e 's/%2B/&/g' -e 's/%C3/A/g' -e 's/%B1/&/g' -e 's/%5B//g' -e 's/%5D//g' -e 's!%2F!/!g' -e 's/|/ /g' -e 's/(/ /g' -e 's/)/ /g' -e 's/+/ /g' -e 's/\//-/g' -e 's/,/ /g' -e 's/;/ /g' -e 's/:/ /g' -e 's/\.\+/./g'` |
---|
| 66 | |
---|
| 67 | if [ ! -z "$TITLE" ] && [ ! -z "$NEWPAGE" ];then |
---|
| 68 | if [ ! -e $TMP/$PARSER.$INPUT.$FILENAME.list ];then |
---|
| 69 | touch $TMP/$PARSER.$INPUT.$FILENAME.list |
---|
| 70 | fi |
---|
| 71 | piccount=$[$piccount+1] |
---|
| 72 | LINE="$TITLE $LANG#$SRC $SRC parts $NEWPAGE#$PIC#$PARSER_$piccount.jpg#$NAME#111" |
---|
| 73 | |
---|
| 74 | echo "$LINE" >> $TMP/$PARSER.$INPUT.list |
---|
| 75 | fi |
---|
| 76 | |
---|
| 77 | done 3<$TMP/cache.$PARSER.$INPUT.2 |
---|
| 78 | rm $TMP/cache.* > /dev/null 2>&1 |
---|
| 79 | |
---|
| 80 | echo "$TMP/$PARSER.$INPUT.list" |
---|
| 81 | } |
---|
| 82 | |
---|
[37524] | 83 | videos() |
---|
| 84 | { |
---|
| 85 | $curlbin -o - $URL$PARAM$PAGE | awk -v SRC=$SRC -v INPUT=$INPUT -v PARAM=$PARAM -v PAGE=$PAGE -v PARSER=$PARSER -v NAME=$NAME ' |
---|
| 86 | |
---|
| 87 | BEGIN { title="" |
---|
| 88 | url="" |
---|
| 89 | pic="" |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | /<a href="/ { if(match($0, /class="title">/) != 0) { |
---|
| 93 | i = match($0, /<a href="/) |
---|
| 94 | split(substr($0, i), a, "\"") |
---|
| 95 | url = a[2] |
---|
| 96 | i = match($0, / title="Jetzt /) |
---|
| 97 | split(substr($0, i), a, "\"") |
---|
| 98 | title = substr(a[2], 7, length(a[2]) - 21) |
---|
| 99 | } |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | /<img src="/ { i = match($0, /<img src="/) |
---|
| 103 | split(substr($0, i), a, "\"") |
---|
| 104 | pic = a[2] |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | /<div class="title"><strong>/ { n = split(pic, a, "/") |
---|
| 108 | pic2 = a[n] |
---|
| 109 | print title "#" SRC " " SRC " parts " url "#" pic "#" pic2 "#" NAME "#0" |
---|
| 110 | title="" |
---|
| 111 | url="" |
---|
| 112 | pic="" |
---|
| 113 | pic2="" |
---|
| 114 | } |
---|
| 115 | |
---|
| 116 | END { print "Page " PAGE + 1 "#" SRC " " SRC " " INPUT " " PARAM " " PAGE + 1 "#http://atemio.dyndns.tv/mediathek/menu/next.jpg#next.jpg#" NAME "#0" |
---|
| 117 | } |
---|
| 118 | ' >/tmp/tithek/$PARSER.list |
---|
| 119 | echo "/tmp/tithek/$PARSER.list" |
---|
| 120 | } |
---|
| 121 | |
---|
| 122 | parts() |
---|
| 123 | { |
---|
| 124 | $curlbin -o - $URL$PARAM >/tmp/tithek/kkiste.1 |
---|
| 125 | cat /tmp/tithek/kkiste.1 | awk -v SRC=$SRC -v INPUT=$INPUT -v PARAM=$PARAM -v PAGE=$PAGE -v PARSER=$PARSER -v NAME=$NAME ' |
---|
| 126 | BEGIN { kz_parts=0 |
---|
| 127 | count=1 |
---|
| 128 | } |
---|
| 129 | |
---|
[37525] | 130 | /<div class="mediabar">/ { kz_parts=1 |
---|
| 131 | next |
---|
[37524] | 132 | } |
---|
| 133 | |
---|
| 134 | /<a href="/ { if(kz_parts!=0) { |
---|
| 135 | i = match($0, /<a href="/) |
---|
| 136 | split(substr($0, i), a, "\"") |
---|
| 137 | url = a[2] |
---|
| 138 | i = match($0, /target="/) |
---|
| 139 | split(substr($0, i), a, "\"") |
---|
| 140 | title = a[3] |
---|
| 141 | sub(/>/, "", title) |
---|
| 142 | sub(/<small>/, "", title) |
---|
| 143 | sub(/<\/small><\/a><\/li>/, "", title) |
---|
| 144 | split(title, a, "\[") |
---|
| 145 | split(a[2], b, "\]") |
---|
| 146 | split(b[1], a, " ") |
---|
| 147 | part = a[2] |
---|
| 148 | print title "#" SRC " " SRC " hoster " PARAM " " count "#http://atemio.dyndns.tv/mediathek/menu/" part ".jpg#" part ".jpg#" NAME "#111" |
---|
| 149 | count=count+1 |
---|
| 150 | next |
---|
| 151 | } |
---|
| 152 | } |
---|
| 153 | |
---|
[37525] | 154 | /<div class="ad leaderboard">/ { kz_parts=0 |
---|
| 155 | next |
---|
[37524] | 156 | } |
---|
| 157 | ' >/tmp/tithek/$PARSER.list |
---|
| 158 | echo "/tmp/tithek/$PARSER.list" |
---|
| 159 | } |
---|
| 160 | |
---|
| 161 | hoster() |
---|
| 162 | { |
---|
| 163 | i=`expr $PAGE \* 2` |
---|
[39612] | 164 | data=`$curlbin "$URL$PARAM" | grep "data-det=" | cut -d'"' -f4` |
---|
[37526] | 165 | if [ ! -z "$data" ];then |
---|
[39612] | 166 | id=`$curlbin --header "Content-Type: application/json" -H "X-Requested-With: XMLHttpRequest" -X POST --data "$data" --referer $URL$PARAM http://kkiste.to/xhr/link/ | cut -d'"' -f$i` |
---|
[37526] | 167 | fi |
---|
| 168 | if [ -z "$id" ];then |
---|
[39612] | 169 | id=`$curlbin "$URL$PARAM" | grep "http://www.ecostream.tv/stream" | sed 's#http://www.ecostream.tv/stream/#\nlink=.#g' | cut -d"." -f2` |
---|
[37526] | 170 | fi |
---|
[37524] | 171 | echo "http://www.ecostream.tv/stream/$id.html" |
---|
| 172 | } |
---|
| 173 | |
---|
| 174 | case $INPUT in |
---|
| 175 | init) $INPUT;; |
---|
| 176 | mainmenu) $INPUT;; |
---|
| 177 | videos) $INPUT;; |
---|
| 178 | parts) $INPUT;; |
---|
| 179 | serien) $INPUT;; |
---|
| 180 | hoster) $INPUT;; |
---|
[39612] | 181 | search) $INPUT;; |
---|
[37524] | 182 | page) $INPUT;; |
---|
| 183 | esac |
---|
| 184 | |
---|