source: titan/mediathek/localparser_secret/kkiste.sh @ 39627

Last change on this file since 39627 was 39627, checked in by obi, 7 years ago

fix

  • Property svn:executable set to *
File size: 9.6 KB
RevLine 
[37524]1#!/bin/bash
2# box parser for titannit
3
[39612]4. /tmp/localhoster/hoster.sh
5
[37524]6SRC=$1
7INPUT=$2
8PARAM=$3
9PAGE=$4
[39612]10
[39626]11FILENAME=`echo $PARAM | tr '/' '.'`
12
[39625]13URL="http://kkiste.to/"
[37524]14PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'`
15NAME=`echo -n ${PARSER:0:2} | tr '[a-z]' '[A-Z]'`${PARSER:2}
16
17rm -rf $TMP > /dev/null 2>&1
18mkdir $TMP > /dev/null 2>&1
19
20if [ `echo $SRC | grep ^"/mnt/parser" |wc -l` -gt 0 ];then
21        TYPE="$SRC - Shell script"
22elif [ `echo $SRC | grep ^"/var/swap" | wc -l` -gt 0 ];then
23        TYPE="Swap - Shell script"
24elif [ `echo $SRC | grep ^"/mnt/swapextensions" | wc -l` -gt 0 ];then
25        TYPE="Mnt - Shell script"
26else
27        TYPE="Flash - Shell script"
28fi
29
30init()
31{
32        echo "$NAME ($TYPE)#$SRC $SRC mainmenu#http://atemio.dyndns.tv/mediathek/menu/$PARSER.jpg#$PARSER.jpg#TiThek#0"
33}
34
35mainmenu()
36{
[39624]37        if [ -e "$TMP/$PARSER.$INPUT.list" ] ; then
38                rm $TMP/$PARSER.$INPUT.list > /dev/null 2>&1
39        fi
40
[39612]41        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
42        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
43        echo "Search#$SRC $SRC search 'search/?q=%search%'#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#$NAME#112" >>$TMP/$PARSER.$INPUT.list
44        echo "$TMP/$PARSER.$INPUT.list"
[37524]45}
46
[39612]47search()
48{
49        piccount=0
50        $curlbin "$URL/$PARAM" -o "$TMP/cache.$PARSER.$INPUT.1"
51        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
52
53        while read -u 3 ROUND; do
54                ID=`echo $ROUND | cut -d'"' -f1 | tail -n1`
55                PIC=`echo $ROUND | sed 's!"url": !\nurl=!g' | grep ^url= | cut -d'"' -f2 | tail -n1`
56                TITLE=`echo $ROUND | sed 's!class="title">!\ntitle=<!g' | grep ^title= | cut -d'<' -f2`
57                NEWPAGE=`echo $ROUND | sed 's!<a href=!\nfound=!g' | grep ^found= | cut -d'"' -f2 | tail -n1`
58
59                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`
60               
61
62                if [ -z "$PIC" ]; then
63                        PIC="http://atemio.dyndns.tv/mediathek/menu/default.jpg"
64                fi
65
66                TITLE=`echo $TITLE | sed -e 's/&#038;/&/g' -e 's/&amp;/und/g' -e 's/&quot;/"/g' -e 's/&lt;/\</g' -e 's/&#034;/\"/g' -e 's/&#039;/\"/g' -e 's/#034;/\"/g' -e 's/#039;/\"/g' -e 's/&szlig;/Ãx/g' -e 's/&ndash;/-/g' -e 's/&Auml;/Ã/g' -e 's/&Uuml;/ÃS/g' -e 's/&Ouml;/Ã/g' -e 's/&auml;/ä/g' -e 's/&uuml;/ü/g' -e 's/&ouml;/ö/g' -e 's/&eacute;/é/g' -e 's/&egrave;/è/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'`
67
68                if [ ! -z "$TITLE" ] && [ ! -z "$NEWPAGE" ];then
69                        if [ ! -e $TMP/$PARSER.$INPUT.$FILENAME.list ];then
70                                touch $TMP/$PARSER.$INPUT.$FILENAME.list
71                        fi
[39627]72                        piccount=`expr $piccount + 1`
73                        LINE="$TITLE $LANG#$SRC $SRC parts $NEWPAGE#$PIC#$PARSER_$NEWPAGE_$FILENAME_$piccount.jpg#$NAME#0"
[39612]74
75                        echo "$LINE" >> $TMP/$PARSER.$INPUT.list
76                fi
77
78        done 3<$TMP/cache.$PARSER.$INPUT.2
79        rm $TMP/cache.* > /dev/null 2>&1
80
81        echo "$TMP/$PARSER.$INPUT.list"
82}
83
[37524]84videos()
85{
86        $curlbin -o - $URL$PARAM$PAGE | awk -v SRC=$SRC -v INPUT=$INPUT -v PARAM=$PARAM -v PAGE=$PAGE -v PARSER=$PARSER -v NAME=$NAME '
87
88BEGIN { title=""
89        url=""
90        pic=""
91      }
92
93/<a href="/ { if(match($0, /class="title">/) != 0) {
94                 i = match($0, /<a href="/)
95                 split(substr($0, i), a, "\"")
96                 url = a[2]
97                 i = match($0, / title="Jetzt /)
98                 split(substr($0, i), a, "\"")
99                 title = substr(a[2], 7, length(a[2]) - 21)
100              }
101            }
102
103/<img src="/ { i = match($0, /<img src="/)
104               split(substr($0, i), a, "\"")
105               pic = a[2]
106             }
107
108/<div class="title"><strong>/ { n = split(pic, a, "/")
109                                pic2 = a[n]
110                                print title "#" SRC " " SRC " parts " url "#" pic "#" pic2 "#" NAME "#0"
111                                title=""
112                                url=""
113                                pic=""
114                                pic2=""
115                              }
116
117END   { print "Page " PAGE + 1 "#" SRC " " SRC " " INPUT " " PARAM " " PAGE + 1 "#http://atemio.dyndns.tv/mediathek/menu/next.jpg#next.jpg#" NAME "#0"
118      }
[39622]119' >$TMP/$PARSER.$INPUT.list
120        echo "$TMP/$PARSER.$INPUT.list"
[37524]121}
122
123parts()
124{
[39622]125        $curlbin -o - $URL$PARAM >$TMP/cache.$PARSER.$INPUT.1
126
127        cat $TMP/cache.$PARSER.$INPUT.1 | awk -v SRC=$SRC -v INPUT=$INPUT -v PARAM=$PARAM -v PAGE=$PAGE -v PARSER=$PARSER -v NAME=$NAME '
[37524]128BEGIN { kz_parts=0
129        count=1
[39622]130        extra=test
[37524]131      }
132
[37525]133/<div class="mediabar">/ { kz_parts=1
134                           next
[37524]135                 }
[39622]136/<select class="seasonselect"/ { extra=1
137                           next
138                 }
139/<option value="/ { if(extra=1) {
140                 i = match($0, /<option value="/)
141                 split(substr($0, i), a, "\"")
142                 #print url
143                 title = a[2]
144                                 if(title!="") {
145                         count = title
[39624]146                     print "Staffel: " title "#" SRC " " SRC " episodelist " PARAM " " "season=" count "#http://atemio.dyndns.tv/mediathek/menu/s" title ".jpg#s" title ".jpg#" NAME "#0"
[39622]147                         }
148                 next
149              }
150            }
[37524]151
152/<a href="/ { if(kz_parts!=0) {
153                 i = match($0, /<a href="/)
154                 split(substr($0, i), a, "\"")
155                 url = a[2]
156                 i = match($0, /target="/)
157                 split(substr($0, i), a, "\"")
158                 title = a[3]
159                 sub(/>/, "", title)
160                 sub(/<small>/, "", title)
161                 sub(/<\/small><\/a><\/li>/, "", title)
162                 split(title, a, "\[")
163                 split(a[2], b, "\]")
164                 split(b[1], a, " ")
165                 part = a[2]
166                 print title "#" SRC " " SRC " hoster " PARAM " " count "#http://atemio.dyndns.tv/mediathek/menu/" part ".jpg#" part ".jpg#" NAME "#111"
167                 count=count+1
168                 next
169              }
170            }
171
[37525]172/<div class="ad leaderboard">/ { kz_parts=0
173                                 next
[37524]174         }
[39626]175' >$TMP/$PARSER.$INPUT.$FILENAME.list
[39622]176        echo "$TMP/$PARSER.$INPUT.list"
[37524]177}
178
179hoster()
180{
181        i=`expr $PAGE \* 2`
[39612]182        data=`$curlbin "$URL$PARAM" | grep "data-det=" | cut -d'"' -f4`
[39622]183
[37526]184        if [ ! -z "$data" ];then
[39612]185                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]186        fi
[39622]187
[37526]188        if [ -z "$id" ];then
[39612]189                id=`$curlbin "$URL$PARAM" | grep "http://www.ecostream.tv/stream" | sed 's#http://www.ecostream.tv/stream/#\nlink=.#g' | cut -d"." -f2`
[37526]190        fi
[37524]191        echo "http://www.ecostream.tv/stream/$id.html"
192}
193
[39622]194episodelist()
195{
[39626]196        if [ -e "$TMP/$PARSER.$INPUT.$FILENAME.list" ] ; then
197                rm $TMP/$PARSER.$INPUT.$FILENAME.list
[39622]198        fi
199
200        SEASON=`echo $PAGE | cut -d"=" -f2`
201        PARAM1=`echo $PARAM | sed 's!.html!/!g'`
202
203        data=`$curlbin "$URL$PARAM" | grep "data-movie=" | cut -d'"' -f4`
204        $curlbin2 -H "X-Requested-With: XMLHttpRequest" -X POST --data "$PAGE" --referer $URL$PARAM http://kkiste.to/xhr/movies/episodes/$data/ -o "$TMP/cache.$PARSER.$INPUT.1"
205### curl -k -s -v -H "X-Requested-With: XMLHttpRequest" -X POST --data "season=1" --referer http://kkiste.to/24-twenty-four-stream.html http://kkiste.to/xhr/movies/episodes/24-twenty-four-stream/
206
207        cat $TMP/cache.$PARSER.$INPUT.1 | sed 's!},{!\n{!g' | cut -d"[" -f2 >$TMP/cache.$PARSER.$INPUT.2
208
[39624]209        count=0
210
[39622]211        while read -u 3 ROUND; do
[39624]212                count=`expr $count + 1`
213       
[39622]214                TITLE=`echo $ROUND | cut -d'"' -f10 | tail -n1`
215                ID=`echo $ROUND | cut -d'"' -f6 | tail -n1`
216                NEWPAGE="http://www.ecostream.tv/stream/$ID.html"
217                EPISODE=`echo $TITLE | tr ' ' '\n' | tail -n1`
[39624]218                PICNAME=s"$SEASON"e"$EPISODE".jpg
219                PIC="http://atemio.dyndns.tv/mediathek/menu/$PICNAME"
[39622]220
221                TITLE=`echo $TITLE | sed -e 's/&#038;/&/g' -e 's/&amp;/und/g' -e 's/&quot;/"/g' -e 's/&lt;/\</g' -e 's/&#034;/\"/g' -e 's/&#039;/\"/g' -e 's/#034;/\"/g' -e 's/#039;/\"/g' -e 's/&szlig;/Ãx/g' -e 's/&ndash;/-/g' -e 's/&Auml;/Ã/g' -e 's/&Uuml;/ÃS/g' -e 's/&Ouml;/Ã/g' -e 's/&auml;/ä/g' -e 's/&uuml;/ü/g' -e 's/&ouml;/ö/g' -e 's/&eacute;/é/g' -e 's/&egrave;/è/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'`
222
223                if [ ! -z "$TITLE" ] && [ ! -z "$NEWPAGE" ];then
224                        if [ ! -e $TMP/$PARSER.$INPUT.$FILENAME.list ];then
225                                touch $TMP/$PARSER.$INPUT.$FILENAME.list
226                        fi
[39624]227#gehen beide varianten weiss nur nicht ob die folgen dann stimmen
228#                       LINE="$TITLE#$SRC $SRC hoster $PARAM $count#$PIC#$PICNAME#$NAME#111"
229                        LINE="$TITLE#$NEWPAGE#$PIC#$PICNAME#$NAME#14"
[39622]230
[39626]231                        echo "$LINE" >> $TMP/$PARSER.$INPUT.$FILENAME.list
[39622]232                fi
233
234        done 3<$TMP/cache.$PARSER.$INPUT.2
235        rm $TMP/cache.* > /dev/null 2>&1
236
[39626]237        echo "$TMP/$PARSER.$INPUT.$FILENAME.list"
[39622]238}
239
240
[37524]241case $INPUT in
242        init) $INPUT;;
243        mainmenu) $INPUT;;
244        videos) $INPUT;;
245        parts) $INPUT;;
246        serien) $INPUT;;
247        hoster) $INPUT;;
[39612]248        search) $INPUT;;
[37524]249        page) $INPUT;;
[39622]250        episodelist) $INPUT;;
[37524]251esac
252
Note: See TracBrowser for help on using the repository browser.