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

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

fix

  • Property svn:executable set to *
File size: 6.6 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        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/&#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'`
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#0"
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
83videos()
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
87BEGIN { 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
116END   { 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
122parts()
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 '
126BEGIN { kz_parts=0
127        count=1
128      }
129
130/<div class="mediabar">/ { kz_parts=1
131                           next
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
154/<div class="ad leaderboard">/ { kz_parts=0
155                                 next
156         }
157' >/tmp/tithek/$PARSER.list
158        echo "/tmp/tithek/$PARSER.list"
159}
160
161hoster()
162{
163        i=`expr $PAGE \* 2`
164        data=`$curlbin "$URL$PARAM" | grep "data-det=" | cut -d'"' -f4`
165        if [ ! -z "$data" ];then
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`
167        fi
168        if [ -z "$id" ];then
169                id=`$curlbin "$URL$PARAM" | grep "http://www.ecostream.tv/stream" | sed 's#http://www.ecostream.tv/stream/#\nlink=.#g' | cut -d"." -f2`
170        fi
171        echo "http://www.ecostream.tv/stream/$id.html"
172}
173
174case $INPUT in
175        init) $INPUT;;
176        mainmenu) $INPUT;;
177        videos) $INPUT;;
178        parts) $INPUT;;
179        serien) $INPUT;;
180        hoster) $INPUT;;
181        search) $INPUT;;
182        page) $INPUT;;
183esac
184
Note: See TracBrowser for help on using the repository browser.