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

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

tithek update kkiste

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