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

Last change on this file since 39007 was 39007, checked in by Stephan, 8 years ago

try fix bs

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