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

Last change on this file since 39410 was 37526, checked in by obi, 6 years ago

fix kkiste.sh hoster

  • Property svn:executable set to *
File size: 6.2 KB
Line 
1#!/bin/bash
2# box parser for titannit
3
4SRC=$1
5INPUT=$2
6PARAM=$3
7PAGE=$4
8URL="http://kkiste.to/"
9PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'`
10NAME=`echo -n ${PARSER:0:2} | tr '[a-z]' '[A-Z]'`${PARSER:2}
11curlbin="curl -k -s"
12TMP=/tmp/parser
13
14rm -rf $TMP > /dev/null 2>&1
15mkdir $TMP > /dev/null 2>&1
16
17if [ `echo $SRC | grep ^"/mnt/parser" |wc -l` -gt 0 ];then
18        TYPE="$SRC - Shell script"
19elif [ `echo $SRC | grep ^"/var/swap" | wc -l` -gt 0 ];then
20        TYPE="Swap - Shell script"
21elif [ `echo $SRC | grep ^"/mnt/swapextensions" | wc -l` -gt 0 ];then
22        TYPE="Mnt - Shell script"
23else
24        TYPE="Flash - Shell script"
25fi
26
27init()
28{
29        echo "$NAME ($TYPE)#$SRC $SRC mainmenu#http://atemio.dyndns.tv/mediathek/menu/$PARSER.jpg#$PARSER.jpg#TiThek#0"
30}
31
32mainmenu()
33{
34        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/tithek/$PARSER.list
35        echo "Kinofilme#$SRC $SRC videos aktuelle-kinofilme/?page= 1#http://atemio.dyndns.tv/mediathek/menu/all-newfirst.jpg#all-newfirst.jpg#$NAME#0" >>/tmp/tithek/$PARSER.list
36#       echo "Serien#$SRC $SRC videos serien/?page= 1#http://atemio.dyndns.tv/mediathek/menu/all-newfirst.jpg#all-newfirst.jpg#$NAME#0" >>/tmp/tithek/$PARSER.list
37#       echo "Popular Tags#$SRC $SRC tags popular#http://atemio.dyndns.tv/mediathek/menu/category.jpg#category.jpg#$NAME#0" >>/tmp/tithek/$PARSER.list
38#       echo "All Tags#$SRC $SRC tags nonpopular#http://atemio.dyndns.tv/mediathek/menu/category.jpg#category.jpg#$NAME#0" >>/tmp/tithek/$PARSER.list
39#       echo "Long Videos#$SRC $SRC videos tag/0/pc?tag=long+videos#http://atemio.dyndns.tv/mediathek/menu/category.jpg#category.jpg#$NAME#0" >>/tmp/tithek/$PARSER.list
40#       echo "Search#$SRC $SRC videos index/search/0/pc?query=#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#$NAME#112" >>/tmp/tithek/$PARSER.list
41        echo "/tmp/tithek/$PARSER.list"
42}
43
44videos()
45{
46        $curlbin -o - $URL$PARAM$PAGE | awk -v SRC=$SRC -v INPUT=$INPUT -v PARAM=$PARAM -v PAGE=$PAGE -v PARSER=$PARSER -v NAME=$NAME '
47
48BEGIN { title=""
49        url=""
50        pic=""
51      }
52
53/<a href="/ { if(match($0, /class="title">/) != 0) {
54                 i = match($0, /<a href="/)
55                 split(substr($0, i), a, "\"")
56                 url = a[2]
57                 i = match($0, / title="Jetzt /)
58                 split(substr($0, i), a, "\"")
59                 title = substr(a[2], 7, length(a[2]) - 21)
60              }
61            }
62
63/<img src="/ { i = match($0, /<img src="/)
64               split(substr($0, i), a, "\"")
65               pic = a[2]
66             }
67
68/<div class="title"><strong>/ { n = split(pic, a, "/")
69                                pic2 = a[n]
70                                print title "#" SRC " " SRC " parts " url "#" pic "#" pic2 "#" NAME "#0"
71                                title=""
72                                url=""
73                                pic=""
74                                pic2=""
75                              }
76
77END   { print "Page " PAGE + 1 "#" SRC " " SRC " " INPUT " " PARAM " " PAGE + 1 "#http://atemio.dyndns.tv/mediathek/menu/next.jpg#next.jpg#" NAME "#0"
78      }
79' >/tmp/tithek/$PARSER.list
80        echo "/tmp/tithek/$PARSER.list"
81}
82
83parts()
84{
85        $curlbin -o - $URL$PARAM >/tmp/tithek/kkiste.1
86        cat /tmp/tithek/kkiste.1 | awk -v SRC=$SRC -v INPUT=$INPUT -v PARAM=$PARAM -v PAGE=$PAGE -v PARSER=$PARSER -v NAME=$NAME '
87BEGIN { kz_parts=0
88        count=1
89      }
90
91/<div class="mediabar">/ { kz_parts=1
92                           next
93                 }
94
95/<a href="/ { if(kz_parts!=0) {
96                 i = match($0, /<a href="/)
97                 split(substr($0, i), a, "\"")
98                 url = a[2]
99                 i = match($0, /target="/)
100                 split(substr($0, i), a, "\"")
101                 title = a[3]
102                 sub(/>/, "", title)
103                 sub(/<small>/, "", title)
104                 sub(/<\/small><\/a><\/li>/, "", title)
105                 split(title, a, "\[")
106                 split(a[2], b, "\]")
107                 split(b[1], a, " ")
108                 part = a[2]
109                 print title "#" SRC " " SRC " hoster " PARAM " " count "#http://atemio.dyndns.tv/mediathek/menu/" part ".jpg#" part ".jpg#" NAME "#111"
110                 count=count+1
111                 next
112              }
113            }
114
115/<div class="ad leaderboard">/ { kz_parts=0
116                                 next
117         }
118' >/tmp/tithek/$PARSER.list
119        echo "/tmp/tithek/$PARSER.list"
120}
121
122hoster()
123{
124        i=`expr $PAGE \* 2`
125        data=`$curlbin -L --cookie /mnt/network/cookies --cookie-jar /mnt/network/cookies "$URL$PARAM" | grep "data-det=" | cut -d'"' -f4`
126        if [ ! -z "$data" ];then
127                id=`$curlbin -L --cookie /mnt/network/cookies --cookie-jar /mnt/network/cookies --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`
128        fi
129        if [ -z "$id" ];then
130                id=`$curlbin -L --cookie /mnt/network/cookies --cookie-jar /mnt/network/cookies "$URL$PARAM" | grep "http://www.ecostream.tv/stream" | sed 's#http://www.ecostream.tv/stream/#\nlink=.#g' | cut -d"." -f2`
131        fi
132        echo "http://www.ecostream.tv/stream/$id.html"
133}
134
135
136tags()
137{
138        $curlbin -o - ${URL}index/main/0/pc | sed -e 's/{DATA_MARKERS}/data=pc.XX/g' -e 's/{/{\n/g' -e 's/,/,\n/g' -e 's/\[/\[\n/g' -e 's/\}/\n\}/g' -e 's/\]/\n\]/g' | awk -v PARAM=$PARAM -v SRC=$SRC -v NAME=$NAME '
139BEGIN { table = ""
140      }
141/\"/  { m = 1
142        while (m == 1) {
143           s = $0
144           i = gsub("[\"]", "x", s)
145           m = i % 2
146           if (m == 1) {
147              getline l
148              $0 = $0 l
149           }
150        }
151      }
152/^\{/ { next
153      }
154/\[$/ { split($0, a, "\"")
155        table = a[2]
156        next
157      }
158/^\}/ { next
159      }
160/^\]/ { table = ""
161        next
162      }
163      { if (table == PARAM) {
164           split($0, a, "\"")
165           title = a[2]
166           tag = title
167           gsub(/ /, "%20", tag)
168           print title "#" SRC " " SRC " videos index/tag/0/pc?tag=" tag "#http://atemio.dyndns.tv/mediathek/menu/" tag ".jpg#" tag ".jpg#" NAME "#0"
169        }
170      }
171' >/tmp/tithek/$PARSER.list
172        echo "/tmp/tithek/$PARSER.list"
173}
174
175case $INPUT in
176        init) $INPUT;;
177        mainmenu) $INPUT;;
178        videos) $INPUT;;
179        parts) $INPUT;;
180        serien) $INPUT;;
181        hoster) $INPUT;;
182        tags) $INPUT;;
183        page) $INPUT;;
184esac
185
Note: See TracBrowser for help on using the repository browser.