source: titan/mediathek/localparser_secret/bs.sh @ 42588

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

tithek testfix speedup init localhoster

  • Property svn:executable set to *
File size: 9.6 KB
Line 
1#!/bin/bash
2# titannit box parser for burning series
3
4case $2 in
5        init) echo skip load hoster.sh;;
6        *) . /tmp/localhoster/hoster.sh;;
7esac
8
9SRC=$1
10INPUT=$2
11PARAM=$3
12PARAM2=$4
13URL="https://bs.to/"
14PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'`
15NAME="burningseries"
16
17#rm -rf $TMP > /dev/null 2>&1
18mkdir $TMP > /dev/null 2>&1
19
20if [ `echo $SRC | grep ^"/mnt/parser" |wc -l` -gt 0 ];then
21        TYPE="$SRC - Shell script"
22elif [ `echo $SRC | grep ^"/var/swap" | wc -l` -gt 0 ];then
23        TYPE="Swap - Shell script"
24elif [ `echo $SRC | grep ^"/mnt/swapextensions" | wc -l` -gt 0 ];then
25        TYPE="Mnt - Shell script"
26else
27        TYPE="Flash - Shell script"
28fi
29
30init()
31{
32        echo "Burning Series ($TYPE)#$SRC $SRC mainmenu#http://atemio.dyndns.tv/mediathek/menu/$PARSER.jpg#$PARSER.jpg#TiThek#0"
33}
34
35mainmenu()
36{
37        echo "Genres#$SRC $SRC genres#http://atemio.dyndns.tv/mediathek/menu/serien.genre.jpg#serien.genre.jpg#$NAME#0" >/tmp/tithek/$PARSER.mainmenu.list
38        echo "All Series#$SRC $SRC allseries#http://atemio.dyndns.tv/mediathek/menu/serien.jpg#serien.jpg#$NAME#0" >>/tmp/tithek/$PARSER.mainmenu.list
39        echo "Search#$SRC $SRC search#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#$NAME#0" >>/tmp/tithek/$PARSER.mainmenu.list
40        echo "/tmp/tithek/$PARSER.mainmenu.list"
41}
42
43genres()
44{
45        $curlbin -o - $URL"serie-genre" | awk -v SRC=$SRC -v NAME=$NAME '
46BEGIN { in_genres = 0
47      }
48
49/<div class="genre">/ { in_genres = 1
50                        next
51                      }
52
53/<span><strong>/ { i = index($0, "<span><strong>") + 14
54                   j = index($0, "</strong></span>") - i
55                   title = substr($0, i, j)
56                   pic = tolower(title)
57                   print title "#" SRC " " SRC " series " title "#http://atemio.dyndns.tv/mediathek/menu/" pic ".jpg#" pic ".jpg#" NAME "#0"
58                   next
59                 }
60
61' >/tmp/tithek/$PARSER.genres.list
62        echo "/tmp/tithek/$PARSER.genres.list"
63}
64
65series()
66{
67        $curlbin -o - $URL"serie-genre" | awk -v PARAM=$PARAM -v SRC=$SRC -v NAME=$NAME '
68/<span><strong>/ { i = index($0, "<span><strong>") + 14
69                   j = index($0, "</strong></span>") - i
70                   genre = substr($0, i, j)
71                 }
72
73/<li><a href=\"/ { if (genre == PARAM) {
74                      i = index($0, "<li><a href=\"") + 13
75                      j = index(substr($0, i), "\"") - 1
76                      url = substr($0, i, j)
77                      j = index(substr($0, i), "\">") - 1
78                      k = i + j + 2
79                      l = index(substr($0, k), "</a></li>") - 1
80                      title = substr($0, k, l)
81                      print title "#" SRC " " SRC " staffel " url "#http://atemio.dyndns.tv/mediathek/menu/default.jpg#default.jpg#" NAME "#0"
82                   }
83                   next
84                 }
85' >/tmp/tithek/$PARSER.series.list
86        cat /tmp/tithek/$PARSER.series.list | sed -e "s!&#039;!'!g" > /tmp/tithek/$PARSER.series.list.1
87        echo "/tmp/tithek/$PARSER.series.list.1"
88}
89
90allseries()
91{
92        $curlbin -o - $URL"serie-alphabet" | awk -v PARAM=$PARAM -v SRC=$SRC -v NAME=$NAME '
93/<span><strong>/ { i = index($0, "<span><strong>") + 14
94                   j = index($0, "</strong></span>") - i
95                   genre = substr($0, i, j)
96                 }
97
98/<li><a href=\"/ { if (genre == PARAM) {
99                      i = index($0, "<li><a href=\"") + 13
100                      j = index(substr($0, i), "\">") - 1
101                      url = substr($0, i, j)
102                      k = i + j + 2
103                      l = index(substr($0, k), "</a></li>") - 1
104                      title = substr($0, k, l)
105                      print title "#" SRC " " SRC " staffel " url "#http://atemio.dyndns.tv/mediathek/menu/default.jpg#default.jpg#" NAME "#0"
106                   }
107                   next
108                 }
109' >/tmp/tithek/$PARSER.allseries.list
110        echo "/tmp/tithek/$PARSER.allseries.list"
111}
112
113staffel()
114{
115        $curlbin -o - $URL$PARAM | awk -v PARAM=$PARAM -v SRC=$SRC -v NAME=$NAME '
116BEGIN { in_class_clearfix = 0
117      }
118
119/<ul class=\"clearfix\">/ { in_class_clearfix = 1
120                          }
121
122/<li><a href=\"/ { if (in_class_clearfix == 1) {
123                      i = index($0, "<li><a href=\"") + 13
124                      j = index(substr($0, i), "\">") - 1
125                      url = substr($0, i, j)
126                      k = i + j + 2
127                      l = index(substr($0, k), "</a></li>") - 1
128                      staffel = substr($0, k, l)
129                      print "Staffel " staffel "#" SRC " " SRC " episode " url " " staffel "#http://atemio.dyndns.tv/mediathek/menu/s" staffel ".jpg#s" staffel ".jpg#" NAME "#0"
130                   }
131                 }
132
133/<\/ul>/ { in_class_clearfix = 0
134         }
135' >/tmp/tithek/$PARSER.staffel.list
136        echo "/tmp/tithek/$PARSER.staffel.list"
137}
138
139episode()
140{
141        $curlbin -o - $URL$PARAM | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
142BEGIN { in_table_row = 0
143      }
144
145/<tr>/ { in_table_row = 1
146         next
147       }
148
149/<td><a href=\"/ { if (in_table_row == 1) {
150                      i = index($0, "<td><a href=\"") + 13
151                      j = index(substr($0, i), "\"") - 1
152                      url = substr($0, i, j)
153                      i = index($0, "title=\"") + 7
154                      j = index(substr($0, i), "\"") - 1
155                      title = substr($0, i, j)
156                      k = i + j + 2
157                      l = index(substr($0, k), "</a></td>") - 1
158                      episode = substr($0, k, l)
159                      print title "#" SRC " " SRC " hosterlist " url "#http://atemio.dyndns.tv/mediathek/menu/s" PARAM2 "e" episode ".jpg#s" PARAM2 "e" episode ".jpg#" NAME "#0"
160                   }
161                   next
162                 }
163
164/<\/tr>/ { in_table_row = 0
165           next
166         }
167' >/tmp/tithek/$PARSER.episode.list
168        echo "/tmp/tithek/$PARSER.episode.list"
169}
170
171hosterlist()
172{
173        $curlbin -o - $URL$PARAM | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
174BEGIN { in_hosterlist = 0
175      }
176
177/<ul class=\"hoster-tabs top\">/ { in_hosterlist = 1
178                                   next
179                                 }
180
181/href=\"/ { if (in_hosterlist == 1) {
182               i = index($0, "href=\"") + 6
183               j = index(substr($0, i), "\">") - 1
184               url = substr($0, i, j)
185            }
186            next
187          }
188
189/<\/span>&nbsp;/ { if (in_hosterlist == 1) {
190                 i = index($0, "</span>&nbsp;") + 13
191                 title = substr($0, i)
192                 pic = tolower(title)
193                 print title "#" SRC " " SRC " hoster " url "#http://atemio.dyndns.tv/mediathek/menu/" pic ".jpg#" pic ".jpg#" NAME "#111"
194              }
195              next
196            }
197
198/<\/ul>/ { in_hosterlist = 0
199          next
200        }
201
202' >/tmp/tithek/$PARSER.hosterlist.list
203        echo "/tmp/tithek/$PARSER.hosterlist.list"
204}
205
206
207###################
208# in_hoster
209###################
210#<div id="video_actions">
211#                <div>
212#            <a href="http://vivo.sx/dcd747a9af" target="_blank"><span class="icon link_go"></span> Link zum Originalvideo</a>
213#                    </div>
214#            </div>
215#    <br style="clear:both;"/>
216
217###################
218# in_hoster_iframe
219###################
220#<iframe scrolling='no' frameborder='no' width='630' height='390' allowfullscreen='ture' webkitallowfullscreen='true' mozallowfullscreen='true' src='https://openload.co/embed/r3Qxa6zWdwM/Die.Simpsons.S01E01.Es.weihnachtet.schwer.German.DVDRiP.XviD.iNTERNAL-UTOPiA.mkv'></iframe>
221#        <div id="video_actions">
222#                <div>
223#            <a href="javascript:alert(&#039;Nicht möglich&#039;);" target="_blank"><span class="icon link_go"></span> Link zum Originalvideo</a>
224#                    </div>
225#            </div>
226#    <br style="clear:both;"/>
227
228
229#function followlocation()
230#{
231#       system("curlbin -s -D - $1 | grep Location: | tail -n1")
232#}
233
234hoster()
235{
236        STREAM=`$curlbin -o - $URL$PARAM | awk '
237/class=\"hoster-player\"/ { i = index($0, "<a href=\"") + 9
238                            j = index(substr($0, i), "\"") - 1
239                            url = substr($0, i, j)
240                            print url
241                            next
242                          }
243'`
244
245        STREAM=`echo $STREAM | sed 's!https://bs.to/out/!watch/!'`
246        HEADER=`$BIN /tmp/localhoster/bs.py $STREAM`
247
248        $curlbin -H "$HEADER" -o - $URL/api/$STREAM >/tmp/tithek/$PARSER.hoster.1
249        cat /tmp/tithek/$PARSER.hoster.1 | grep fullurl | sed 's!fullurl!\nfullurl!' | grep ^fullurl | cut -d'"' -f3 | tr -d '\\'
250}
251
252hosterold()
253{
254        STREAM=`$curlbin -o - $URL$PARAM | awk '
255/class=\"hoster-player\"/ { i = index($0, "<a href=\"") + 9
256                            j = index(substr($0, i), "\"") - 1
257                            url = substr($0, i, j)
258                            print url
259                            next
260                          }
261'`
262        $curlbin -o - $STREAM >/tmp/tithek/$PARSER.hoster.1
263        cat /tmp/tithek/$PARSER.hoster.1 | $curlbin -o - $STREAM | awk '
264/\"og:url\" content=/ { i = index($0, "\"og:url\" content=") + 18
265                        j = index(substr($0, i), "\"") - 1
266                        url = substr($0, i, j)
267                        print url
268                        next
269                      }
270/name=\"id\" value=\"/ { i = index($0, "value=\"") + 7
271                         j = index(substr($0, i), "\"") - 1
272                         url = "http://vidto.me/" substr($0, i, j) ".html"
273                         print url
274                         next
275                       }
276' >/tmp/tithek/$PARSER.hoster.list
277        cat /tmp/tithek/$PARSER.hoster.list
278}
279
280case $INPUT in
281        init) $INPUT;;
282        mainmenu) $INPUT;;
283        genres) $INPUT;;
284        series) $INPUT;;
285        allseries) $INPUT;;
286        staffel) $INPUT;;
287        episode) $INPUT;;
288        hosterlist) $INPUT;;
289        hoster) $INPUT;;
290esac
291
Note: See TracBrowser for help on using the repository browser.