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

Last change on this file since 37525 was 37525, checked in by tt4sk, 8 years ago

[TiThek] fixed: kkiste.to website changed

  • Property svn:executable set to *
File size: 5.8 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 "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
35#       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
36#       echo "Popular Tags#$SRC $SRC tags popular#http://atemio.dyndns.tv/mediathek/menu/category.jpg#category.jpg#$NAME#0" >>/tmp/tithek/$PARSER.list
37#       echo "All Tags#$SRC $SRC tags nonpopular#http://atemio.dyndns.tv/mediathek/menu/category.jpg#category.jpg#$NAME#0" >>/tmp/tithek/$PARSER.list
38#       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
39#       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
40        echo "/tmp/tithek/$PARSER.list"
41}
42
43videos()
44{
45        $curlbin -o - $URL$PARAM$PAGE | awk -v SRC=$SRC -v INPUT=$INPUT -v PARAM=$PARAM -v PAGE=$PAGE -v PARSER=$PARSER -v NAME=$NAME '
46
47BEGIN { title=""
48        url=""
49        pic=""
50      }
51
52/<a href="/ { if(match($0, /class="title">/) != 0) {
53                 i = match($0, /<a href="/)
54                 split(substr($0, i), a, "\"")
55                 url = a[2]
56                 i = match($0, / title="Jetzt /)
57                 split(substr($0, i), a, "\"")
58                 title = substr(a[2], 7, length(a[2]) - 21)
59              }
60            }
61
62/<img src="/ { i = match($0, /<img src="/)
63               split(substr($0, i), a, "\"")
64               pic = a[2]
65             }
66
67/<div class="title"><strong>/ { n = split(pic, a, "/")
68                                pic2 = a[n]
69                                print title "#" SRC " " SRC " parts " url "#" pic "#" pic2 "#" NAME "#0"
70                                title=""
71                                url=""
72                                pic=""
73                                pic2=""
74                              }
75
76END   { print "Page " PAGE + 1 "#" SRC " " SRC " " INPUT " " PARAM " " PAGE + 1 "#http://atemio.dyndns.tv/mediathek/menu/next.jpg#next.jpg#" NAME "#0"
77      }
78' >/tmp/tithek/$PARSER.list
79        echo "/tmp/tithek/$PARSER.list"
80}
81
82parts()
83{
84        $curlbin -o - $URL$PARAM >/tmp/tithek/kkiste.1
85        cat /tmp/tithek/kkiste.1 | awk -v SRC=$SRC -v INPUT=$INPUT -v PARAM=$PARAM -v PAGE=$PAGE -v PARSER=$PARSER -v NAME=$NAME '
86BEGIN { kz_parts=0
87        count=1
88      }
89
90/<div class="mediabar">/ { kz_parts=1
91                           next
92                 }
93
94/<a href="/ { if(kz_parts!=0) {
95                 i = match($0, /<a href="/)
96                 split(substr($0, i), a, "\"")
97                 url = a[2]
98                 i = match($0, /target="/)
99                 split(substr($0, i), a, "\"")
100                 title = a[3]
101                 sub(/>/, "", title)
102                 sub(/<small>/, "", title)
103                 sub(/<\/small><\/a><\/li>/, "", title)
104                 split(title, a, "\[")
105                 split(a[2], b, "\]")
106                 split(b[1], a, " ")
107                 part = a[2]
108                 print title "#" SRC " " SRC " hoster " PARAM " " count "#http://atemio.dyndns.tv/mediathek/menu/" part ".jpg#" part ".jpg#" NAME "#111"
109                 count=count+1
110                 next
111              }
112            }
113
114/<div class="ad leaderboard">/ { kz_parts=0
115                                 next
116         }
117' >/tmp/tithek/$PARSER.list
118        echo "/tmp/tithek/$PARSER.list"
119}
120
121hoster()
122{
123        i=`expr $PAGE \* 2`
124        data=`$curlbin -L --cookie /mnt/network/cookies --cookie-jar /mnt/network/cookies "$URL$PARAM" | grep "data-det=" | cut -d'"' -f4`
125        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`
126        echo "http://www.ecostream.tv/stream/$id.html"
127}
128
129tags()
130{
131        $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 '
132BEGIN { table = ""
133      }
134/\"/  { m = 1
135        while (m == 1) {
136           s = $0
137           i = gsub("[\"]", "x", s)
138           m = i % 2
139           if (m == 1) {
140              getline l
141              $0 = $0 l
142           }
143        }
144      }
145/^\{/ { next
146      }
147/\[$/ { split($0, a, "\"")
148        table = a[2]
149        next
150      }
151/^\}/ { next
152      }
153/^\]/ { table = ""
154        next
155      }
156      { if (table == PARAM) {
157           split($0, a, "\"")
158           title = a[2]
159           tag = title
160           gsub(/ /, "%20", tag)
161           print title "#" SRC " " SRC " videos index/tag/0/pc?tag=" tag "#http://atemio.dyndns.tv/mediathek/menu/" tag ".jpg#" tag ".jpg#" NAME "#0"
162        }
163      }
164' >/tmp/tithek/$PARSER.list
165        echo "/tmp/tithek/$PARSER.list"
166}
167
168case $INPUT in
169        init) $INPUT;;
170        mainmenu) $INPUT;;
171        videos) $INPUT;;
172        parts) $INPUT;;
173        serien) $INPUT;;
174        hoster) $INPUT;;
175        tags) $INPUT;;
176        page) $INPUT;;
177esac
178
Note: See TracBrowser for help on using the repository browser.