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

Last change on this file since 39615 was 39415, checked in by tt4sk, 7 years ago

[TiThek] fixed: bs.to website changed

  • Property svn:executable set to *
File size: 11.0 KB
Line 
1#!/bin/bash
2# titannit box parser for burning series
3
4. /tmp/localhoster/hoster.sh
5
6SRC=$1
7INPUT=$2
8PARAM=$3
9PARAM2=$4
10URL="https://bs.to/"
11PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'`
12NAME="burningseries"
13curlbin="curl -k -s"
14
15#rm -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 "Burning Series ($TYPE)#$SRC $SRC mainmenu#http://atemio.dyndns.tv/mediathek/menu/$PARSER.jpg#$PARSER.jpg#TiThek#0"
31}
32
33mainmenu()
34{
35        echo "Genres#$SRC $SRC genres#http://atemio.dyndns.tv/mediathek/menu/serien.genre.jpg#serien.genre.jpg#$NAME#0" >/tmp/tithek/$PARSER.mainmenu.list
36        echo "All Series#$SRC $SRC allseries#http://atemio.dyndns.tv/mediathek/menu/serien.jpg#serien.jpg#$NAME#0" >>/tmp/tithek/$PARSER.mainmenu.list
37        echo "Search#$SRC $SRC search#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#$NAME#0" >>/tmp/tithek/$PARSER.mainmenu.list
38        echo "/tmp/tithek/$PARSER.mainmenu.list"
39}
40
41genres()
42{
43        $curlbin -o - $URL"andere-serien" | awk -v SRC=$SRC -v NAME=$NAME '
44BEGIN { in_genres = 0
45      }
46
47/<div class="genre">/ { in_genres = 1
48                        next
49                      }
50
51/<span><strong>/ { i = index($0, "<span><strong>") + 14
52                   j = index($0, "</strong></span>") - i
53                   title = substr($0, i, j)
54                   pic = tolower(title)
55                   print title "#" SRC " " SRC " series " title "#http://atemio.dyndns.tv/mediathek/menu/" pic ".jpg#" pic ".jpg#" NAME "#0"
56                   next
57                 }
58
59' >/tmp/tithek/$PARSER.genres.list
60        echo "/tmp/tithek/$PARSER.genres.list"
61}
62
63series()
64{
65        $curlbin -o - $URL"andere-serien" | awk -v PARAM=$PARAM -v SRC=$SRC -v NAME=$NAME '
66/<span><strong>/ { i = index($0, "<span><strong>") + 14
67                   j = index($0, "</strong></span>") - i
68                   genre = substr($0, i, j)
69                 }
70
71/<li><a href=\"/ { if (genre == PARAM) {
72                      i = index($0, "<li><a href=\"") + 13
73                      j = index(substr($0, i), "\"") - 1
74                      url = substr($0, i, j)
75                      j = index(substr($0, i), "\">") - 1
76                      k = i + j + 2
77                      l = index(substr($0, k), "</a></li>") - 1
78                      title = substr($0, k, l)
79                      print title "#" SRC " " SRC " staffel " url "#http://atemio.dyndns.tv/mediathek/menu/default.jpg#default.jpg#" NAME "#0"
80                   }
81                   next
82                 }
83' >/tmp/tithek/$PARSER.series.list
84        echo "/tmp/tithek/$PARSER.series.list"
85}
86
87allseries()
88{
89        $curlbin -o - $URL"serie-alphabet" | awk -v PARAM=$PARAM -v SRC=$SRC -v NAME=$NAME '
90/<span><strong>/ { i = index($0, "<span><strong>") + 14
91                   j = index($0, "</strong></span>") - i
92                   genre = substr($0, i, j)
93                 }
94
95/<li><a href=\"/ { if (genre == PARAM) {
96                      i = index($0, "<li><a href=\"") + 13
97                      j = index(substr($0, i), "\">") - 1
98                      url = substr($0, i, j)
99                      k = i + j + 2
100                      l = index(substr($0, k), "</a></li>") - 1
101                      title = substr($0, k, l)
102                      print title "#" SRC " " SRC " staffel " url "#http://atemio.dyndns.tv/mediathek/menu/default.jpg#default.jpg#" NAME "#0"
103                   }
104                   next
105                 }
106' >/tmp/tithek/$PARSER.allseries.list
107        echo "/tmp/tithek/$PARSER.allseries.list"
108}
109
110staffel()
111{
112        $curlbin -o - $URL$PARAM | awk -v PARAM=$PARAM -v SRC=$SRC -v NAME=$NAME '
113/<li class=\" current\">/ { sub(/<li class=\" current\">/, "<li class=\" \">", $0)
114                          }
115
116/<li class=\" \"><a href="/ { i = index($0, "<li class=\" \"><a href=\"") + 23
117                              j = index(substr($0, i), "\">") - 1
118                              url = substr($0, i, j)
119                              k = i + j + 2
120                              l = index(substr($0, k), "</a></li>") - 1
121                              staffel = substr($0, k, l)
122                              print "Staffel " staffel "#" SRC " " SRC " episode " url " " staffel "#http://atemio.dyndns.tv/mediathek/menu/s" staffel ".jpg#s" staffel ".jpg#" NAME "#0"
123                            }
124' >/tmp/tithek/$PARSER.staffel.list
125        echo "/tmp/tithek/$PARSER.staffel.list"
126}
127
128episode()
129{
130        $curlbin -o - $URL$PARAM | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
131BEGIN { in_table_row = 0
132        episode = ""
133        url = ""
134        title = ""
135      }
136/<tr>/ { in_table_row = 1
137         next
138       }
139/<td><a href=\"/ { if (in_table_row == 1) {
140                      i = index($0, "<td><a href=\"") + 13
141                      j = index(substr($0, i), "\">") - 1
142                      url = substr($0, i, j)
143                   }
144                   next
145                 }
146
147/<td>/ { if (in_table_row == 1) {
148            i = index($0, "<td>") + 4
149            j = index(substr($0, i), "</td>") - 1
150            episode = substr($0, i, j)
151         }
152         next
153       }
154
155/<strong>/ { if (in_table_row == 1) {
156                i = index($0, "<strong>") + 8
157                j = index(substr($0, i), "</strong>") - 1
158                title = substr($0, i, j)
159                do {
160                   i = match(title, /&#[0-2][0-9][0-9];/)
161                   if (i != 0) {
162                      j = substr(title, i + 2, 3) * 1
163                      title = substr(title, 1, i - 1) sprintf("%c", j) substr(title, i + 6)
164                   }
165                } while(i != 0)
166             }
167             next
168           }
169
170/<\/tr>/ { if (in_table_row == 1) {
171             if (episode != "") {
172                print title "#" SRC " " SRC " hosterlist " url "#http://atemio.dyndns.tv/mediathek/menu/s" PARAM2 "e" episode ".jpg#s" PARAM2 "e" episode ".jpg#" NAME "#0"
173                title = ""
174                url = ""
175                episode = ""
176             }
177             in_table_row = 0
178          }
179          next
180        }
181
182/<li class=\" current\">/ { sub(/<li class=\" current\">/, "<li class=\" \">", $0)
183                          }
184' >/tmp/tithek/$PARSER.episode.list
185        echo "/tmp/tithek/$PARSER.episode.list"
186}
187
188hosterlist()
189{
190        $curlbin -o - $URL$PARAM | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
191BEGIN { in_hosterlist = 0
192        url = ""
193        title = ""
194      }
195
196/<h3>Hoster dieser Episode<\/h3>/ { in_hosterlist = 1
197                                    next
198                                  }
199
200/href=\"/ { if (in_hosterlist == 1) {
201               i = index($0, "href=\"") + 6
202               j = index(substr($0, i), "\">") - 1
203               url = substr($0, i, j)
204            }
205            next
206          }
207
208/<\/span> / { if (in_hosterlist == 1) {
209                 i = index($0, "</span> ") + 8
210                 j = index(substr($0, i), "</a>") - 1
211                 title = substr($0, i, j)
212                 i = index($0, "</span> ") + 8
213                 j = index(substr($0, i), " -") - 1
214                 pic = substr($0, i, j)
215                 pic = tolower(pic)
216                 print title "#" SRC " " SRC " hoster " url "#http://atemio.dyndns.tv/mediathek/menu/" pic ".jpg#" pic ".jpg#" NAME "#111"
217              }
218              next
219            }
220
221/<\/ul>/ { in_hosterlist = 0
222          next
223        }
224
225' >/tmp/tithek/$PARSER.hosterlist.list
226        echo "/tmp/tithek/$PARSER.hosterlist.list"
227}
228
229
230###################
231# in_hoster
232###################
233#<div id="video_actions">
234#                <div>
235#            <a href="http://vivo.sx/dcd747a9af" target="_blank"><span class="icon link_go"></span> Link zum Originalvideo</a>
236#                    </div>
237#            </div>
238#    <br style="clear:both;"/>
239
240###################
241# in_hoster_iframe
242###################
243#<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>
244#        <div id="video_actions">
245#                <div>
246#            <a href="javascript:alert(&#039;Nicht möglich&#039;);" target="_blank"><span class="icon link_go"></span> Link zum Originalvideo</a>
247#                    </div>
248#            </div>
249#    <br style="clear:both;"/>
250
251
252#function followlocation()
253#{
254#       system("curlbin -s -D - $1 | grep Location: | tail -n1")
255#}
256
257hoster()
258{
259        $curlbin -o - $URL$PARAM | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
260BEGIN { in_hosterlist = 0
261        url = ""
262        title = ""
263      }
264
265/<iframe scrolling=/ { in_hoster_iframe = 1
266                               prew
267                             }
268
269/src=/ { if (in_hoster_iframe == 1) {
270                  i = index($0, "src=") + 5
271                  j = index(substr($0, i), ">") - 2
272                  url = substr($0, i, j)
273                  i = index($0, "<a href=\"") + 16
274                  j = index(substr($0, i), "/") - 1
275                  title = substr($0, i, j)
276
277#                  print "Originalvideo#" url "#http://atemio.dyndns.tv/mediathek/menu/default.jpg#default.jpg#" NAME "#140"
278#                  print title "#" url "#http://atemio.dyndns.tv/mediathek/menu/" title ".jpg#" title ".jpg#" NAME "#14"
279                  print url
280               }
281               next
282             }
283
284/<div id=\"video_actions\">/ { in_hoster = 1
285                               next
286                             }
287
288/<a href=\"/ { if (in_hoster == 1 && in_hoster_iframe == 0) {
289                  i = index($0, "<a href=\"") + 9
290                  j = index(substr($0, i), "\"") - 1
291                  url = substr($0, i, j)
292
293                  i = index($0, "<a href=\"") + 16
294                  j = index(substr($0, i), "/") - 1
295                  title = substr($0, i, j)
296
297#                  print "Originalvideo#" url "#http://atemio.dyndns.tv/mediathek/menu/default.jpg#default.jpg#" NAME "#140"
298#                  print title "#" url "#http://atemio.dyndns.tv/mediathek/menu/" title ".jpg#" title ".jpg#" NAME "#14"
299
300tmp = "curl -k -s -L --cookie /mnt/network/cookies --cookie-jar /mnt/network/cookies -A \"Mozilla\/5.0 \(Windows NT 6.3\; WOW64\) AppleWebKit\/537.36 \(KHTML, like Gecko\) Maxthon\/4.4.7.3000 Chrome\/30.0.1599.101 Safari\/537.36\" -s -D - " url " | grep Location: | tail -n1 | cut -d \" \" -f2"
301#tmp = "curl -s -D - " url " | grep Location: | tail -n1"
302
303                                        while ((tmp | getline) > 0)
304                                           print
305                                           #print tmp
306                                           #print $0
307                                       
308                                        close(tmp)
309               }
310               next
311             }
312
313/<\/div>/ { in_hoster = 0
314                        in_hoster_iframe = 0
315            next
316          }
317
318' >/tmp/tithek/$PARSER.hoster.list
319#       echo "/tmp/tithek/$PARSER.hoster.list"
320        cat     "/tmp/tithek/$PARSER.hoster.list"
321}
322
323case $INPUT in
324        init) $INPUT;;
325        mainmenu) $INPUT;;
326        genres) $INPUT;;
327        series) $INPUT;;
328        allseries) $INPUT;;
329        staffel) $INPUT;;
330        episode) $INPUT;;
331        hosterlist) $INPUT;;
332        hoster) $INPUT;;
333esac
334
Note: See TracBrowser for help on using the repository browser.