source: titan/mediathek/localparser_secret/serienstream.sh @ 42609

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

tithek add serienstream currently menu only support

File size: 8.9 KB
Line 
1#!/bin/sh
2# first sh box parser for titannit mfg obi
3
4case $2 in
5        init) echo skip load hoster.sh;;
6        *) . /tmp/localhoster/hoster.sh;;
7esac
8
9#SRC=$1
10#INPUT=$2
11#PAGE=$3
12#NEXT=$4
13#
14#FILENAME=`echo $PAGE | tr '/' '.'`
15#FILENAME=`echo $FILENAME | tr '&' '.'`
16#
17#if [ -z "$PAGE" ]; then
18#       FILENAME=none
19#fi
20
21SRC=$1
22INPUT=$2
23PAGE=$3
24NEXT=$4
25PAGE2=$5
26PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'`
27
28FILENAME="$PARSER $INPUT $PAGE $NEXT $PAGE2"
29FILENAME=`echo $FILENAME  | sed -e 's/\-\+/./g' | sed -e 's/\+\+/./g' | tr '&' '.' | tr '/' '.' | tr '?' '.'  | tr '=' '.' | sed 's/ \+/./g' | sed 's/\.\+/./g'`
30PICNAME=`echo $FILENAME`
31
32if [ -z "$FILENAME" ]; then
33        FILENAME=none
34fi
35
36URL=https://s.to
37PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'`
38NAME=SerienStream
39
40mkdir $TMP > /dev/null 2>&1
41
42if [ `echo $SRC | grep ^"/mnt/parser" | wc -l` -gt 0 ];then
43        TYPE="$SRC - Shell script"
44elif [ `echo $SRC | grep ^"/var/swap" | wc -l` -gt 0 ];then
45        TYPE="Swap - Shell script"
46elif [ `echo $SRC | grep ^"/mnt/swapextensions" | wc -l` -gt 0 ];then
47        TYPE="Mnt - Shell script"
48else
49        TYPE="Flash - Shell script"
50fi
51
52init()
53{
54        rm -rf $TMP > /dev/null 2>&1
55        echo "$NAME ($TYPE)#$SRC $SRC mainmenu#http://atemio.dyndns.tv/mediathek/menu/$PARSER.jpg#$PARSER.jpg#TiThek#0"
56}
57
58mainmenu()
59{
60        echo "Tv-Shows (A-Z)#$SRC $SRC sorted 'katalog'#http://atemio.dyndns.tv/mediathek/menu/tv-shows.jpg#tv-shows.jpg#$NAME#0" >$TMP/$FILENAME.list
61        echo "All Series#$SRC $SRC all 'serien'#http://atemio.dyndns.tv/mediathek/menu/all-sorted.jpg#all-sorted.jpg#$NAME#0" >>$TMP/$FILENAME.list
62        echo "$TMP/$FILENAME.list"
63}
64
65
66sorted()
67{
68        if [ ! -e "$TMP/$FILENAME.list" ]; then
69                watchlist="0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
70
71                rm $TMP/$FILENAME.list > /dev/null 2>&1
72
73                for ROUND in $watchlist; do
74                        TITLE=`echo $ROUND`
75                        filename=`echo $TITLE | tr [A-Z] [a-z]`
76                        echo "$TITLE#$SRC $SRC list '$PAGE/$ROUND'#http://atemio.dyndns.tv/mediathek/menu/$filename.jpg#$filename.jpg#$NAME#0" >> $TMP/$FILENAME.list
77                done
78        fi
79        echo "$TMP/$FILENAME.list"
80}
81
82all()
83{
84        if [ ! -e "$TMP/$FILENAME.list" ]; then
85                $curlbin -o - $URL/$PAGE | sed 's/<li><a/\n<li><a/g' | grep "/serie/" | grep 'data-alternative-title=""'| sort -u | awk -v SRC=$SRC -v NAME=$NAME -v PICNAME=$PICNAME -v INPUT=$INPUT -v PAGE=$PAGE -v NEXT=$NEXT \
86                '
87                        # BEGIN variable setzen
88                        BEGIN
89                                {
90#                                       print "start"
91                                }
92                                # next page init
93                                # <li><a data-alternative-title="" href="/serie/stream/zwei-himmlische-toechter" title="Zwei himmlische Töchter Stream anschauen">Zwei himmlische Töchter</a></li>
94                                /href/ \
95                                {
96#                                       print "$0" $0
97
98                                        # extrahiere den newpage pfad
99                                        i = index($0, "href=\"") + 6
100                            j = index(substr($0, i), "\"") - 1
101                                        # newpage = /view_video.php?viewkey=127170590
102                            newpage = substr($0, i, j)
103
104                                        # extrahiere den newpage pfad
105                                        i = index($0, "\">") + 2
106                            j = index(substr($0, i), "<") - 1
107                                        # newpage = /view_video.php?viewkey=127170590
108                            title = substr($0, i, j)
109
110                                        if (title != "")
111                                        {
112                                                if ( pic == "" )
113                                                {
114                                                pic = "http://atemio.dyndns.tv/mediathek/menu/default.jpg"
115                                                }
116
117                                                piccount += 1
118                                                # 25. in naechste zeile springen
119                                                # 26. \x27 = single quotes
120                                                print title "#" SRC " " SRC " season \x27" newpage "\x27#" pic "#" PICNAME "." piccount ".jpg#" NAME "#0"
121                                        }
122                                        next
123                                }
124                # 29. schreibe alles in die list datei
125                ' >$TMP/$FILENAME.list
126        fi
127        # 30. gebe titan den list namen mit pfad zurueck
128        echo "$TMP/$FILENAME.list"
129#       cat "$TMP/$FILENAME.list"
130}
131
132#<ul>
133#        <li><span><strong>Staffeln:</strong></span></li>
134#                    <li>  <a class="active" href="/serie/stream/lucifer/staffel-1" title="Staffel 1">1</a>  </li>
135#                    <li>  <a href="/serie/stream/lucifer/staffel-2" title="Staffel 2">2</a>  </li>
136#                    <li>  <a href="/serie/stream/lucifer/staffel-3" title="Staffel 3">3</a>  </li>  </ul>
137
138season()
139{
140        if [ ! -e "$TMP/$FILENAME.list" ]; then
141                $curlbin -o - $URL/$PAGE | awk -v SRC=$SRC -v NAME=$NAME -v PICNAME=$PICNAME -v INPUT=$INPUT -v PAGE=$PAGE -v NEXT=$NEXT \
142                '
143                        # BEGIN variable setzen
144                        BEGIN
145                                {
146                                        suche = 0
147                                }
148                                # next page init
149                                /<strong>Staffeln:<\/strong>/ \
150                                {
151                                        suche = 1
152#                                       next
153                                }
154                                /href=/ \
155                                {
156                                        if ( suche == 1 )
157                                        {
158                                                # extrahiere den newpage pfad
159                                                i = index($0, "href=\"") + 6
160                                        j = index(substr($0, i), "\"") - 1
161                                        newpage = substr($0, i, j)
162
163                                                # extrahiere den title pfad
164                                                i = index($0, "title=\"") + 7
165                                        j = index(substr($0, i), "\"") - 1
166                                        title = substr($0, i, j)
167
168                                                if (title != "")
169                                                {
170                                                        if ( pic == "" )
171                                                        {
172                                                                pic = "http://atemio.dyndns.tv/mediathek/menu/default.jpg"
173                                                        }
174
175                                                        piccount += 1
176                                                        # 25. in naechste zeile springen
177                                                        # 26. \x27 = single quotes
178
179                                                        split(title, a, " ")
180                                                        season = a[2]
181                                                        print title "#" SRC " " SRC " episode \x27" newpage "\x27#http://atemio.dyndns.tv/mediathek/menu/s" season ".jpg#s" season ".jpg#" NAME "#0"
182#                                                       print title "#" SRC " " SRC " episode \x27" newpage "\x27#" pic "#" PICNAME "." piccount ".jpg#" NAME "#0"
183                                                }
184                                                next
185                                        }
186                                }
187                                /<div class="cf"><\/div>/ \
188                                {
189                                        if ( suche == 1 )
190                                        {
191                                                suche = 0
192                                        }
193                                        next
194                                }
195
196                # 29. schreibe alles in die list datei
197                ' >$TMP/$FILENAME.list
198        fi
199        # 30. gebe titan den list namen mit pfad zurueck
200        echo "$TMP/$FILENAME.list"
201#       cat "$TMP/$FILENAME.list"
202}
203
204episode()
205{
206        if [ ! -e "$TMP/$FILENAME.list" ]; then
207                $curlbin -o - $URL/$PAGE | awk -v SRC=$SRC -v NAME=$NAME -v PICNAME=$PICNAME -v INPUT=$INPUT -v PAGE=$PAGE -v NEXT=$NEXT \
208                '
209                        # BEGIN variable setzen
210                        BEGIN
211                                {
212                                        suche = 0
213                                }
214                                # next page init
215                                /<strong>Episoden:<\/strong>/ \
216                                {
217                                        suche = 1
218#                                       next
219                                }
220                                #<li>  <a class="active" href="/serie/stream/lucifer/staffel-1" title="Staffel 1">1</a>  </li>
221                                /href=/ \
222                                {
223                                        if ( suche == 1 )
224                                        {
225                                                # extrahiere den newpage pfad
226                                                i = index($0, "href=\"") + 6
227                                        j = index(substr($0, i), "\"") - 1
228                                        newpage = substr($0, i, j)
229
230                                                # extrahiere den title pfad
231                                                i = index($0, "title=\"") + 7
232                                        j = index(substr($0, i), "\"") - 1
233                                        title = substr($0, i, j)
234
235                                                if (title != "")
236                                                {
237                                                        if ( pic == "" )
238                                                        {
239                                                                pic = "http://atemio.dyndns.tv/mediathek/menu/default.jpg"
240                                                        }
241
242                                                        piccount += 1
243                                                        # 25. in naechste zeile springen
244                                                        # 26. \x27 = single quotes
245
246                                                        #Staffel 3 Episode 26
247                                                        split(title, a, " ")
248                                                        season = a[2]
249                                                        episode = a[4]
250                                                        print title "#" SRC " " SRC " episode \x27" newpage "\x27#http://atemio.dyndns.tv/mediathek/menu/s" season "e" episode ".jpg#s" season "e" episode ".jpg#" NAME "#0"
251
252#                                                       print title "#" SRC " " SRC " episode \x27" newpage "\x27#" pic "#" PICNAME "." piccount ".jpg#" NAME "#0"
253                                                }
254                                                next
255                                        }
256                                }
257                                /<div class="cf"><\/div>/ \
258                                {
259                                        if ( suche == 1 )
260                                        {
261                                                suche = 0
262                                        }
263                                        next
264                                }
265
266                # 29. schreibe alles in die list datei
267                ' >$TMP/$FILENAME.list
268        fi
269        # 30. gebe titan den list namen mit pfad zurueck
270        echo "$TMP/$FILENAME.list"
271#       cat "$TMP/$FILENAME.list"
272}
273
274list()
275{
276        if [ ! -e "$TMP/$FILENAME.list" ]; then
277                $curlbin -o - $URL/$PAGE | sed 's/<div/\n<div/g' | awk -v SRC=$SRC -v NAME=$NAME -v PICNAME=$PICNAME -v INPUT=$INPUT -v URL=$URL -v PAGE=$PAGE -v NEXT=$NEXT \
278                '
279                        # BEGIN variable setzen
280                        BEGIN
281                                {
282                                        suche = 0
283                                }
284                                # next page init
285                                /<div class="seriesListContainer row">/ \
286                                {
287                                        suche = 1
288                                }
289                                /<div class="cf"><\/div>/ \
290                                {
291                                        if ( suche == 1 )
292                                        {
293                                                suche = 0
294                                        }
295                                        next
296                                }
297                                /<div class="col-md-15 col-sm-3 col-xs-6">/ \
298                                {
299                                        if ( suche == 1 )
300                                        {
301                                                # extrahiere den newpage pfad
302                                                i = index($0, "href=\"") + 6
303                                        j = index(substr($0, i), "\"") - 1
304                                        newpage = substr($0, i, j)
305
306                                                # extrahiere den title pfad
307                                                i = index($0, "title=\"") + 7
308                                        j = index(substr($0, i), "\"") - 1
309                                        title = substr($0, i, j)
310
311
312                                                # extrahiere den title pfad
313                                                i = index($0, "<h3>") + 4
314                                        j = index(substr($0, i), "<") - 1
315                                        title = substr($0, i, j)
316
317
318                                                i = index($0, "img src=\"") + 9
319                                        j = index(substr($0, i), "\"") - 1
320                                        pic = substr($0, i, j)
321
322                                                if (title != "")
323                                                {
324                                                        if ( pic == "" )
325                                                        {
326                                                                pic = "http://atemio.dyndns.tv/mediathek/menu/default.jpg"
327                                                        }
328
329                                                        piccount += 1
330                                                        # 25. in naechste zeile springen
331                                                        # 26. \x27 = single quotes
332                                                        print title "#" SRC " " SRC " season \x27" newpage "\x27#" URL pic "#" PICNAME "." piccount ".jpg#" NAME "#0"
333                                                }
334#                                               next
335                                        }
336                                }
337                # 29. schreibe alles in die list datei
338                ' >$TMP/$FILENAME.list
339        fi
340        # 30. gebe titan den list namen mit pfad zurueck
341        echo "$TMP/$FILENAME.list"
342#       cat "$TMP/$FILENAME.list"
343}
344
345case $INPUT in
346        init) $INPUT;;
347        mainmenu) $INPUT;;
348        all) $INPUT;;
349        sorted) $INPUT;;
350        season) $INPUT;;
351        episode) $INPUT;;
352        list) $INPUT;;
353esac
Note: See TracBrowser for help on using the repository browser.