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

Last change on this file since 39401 was 39357, checked in by obi, 7 years ago

fix bs an vivo

  • 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                      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
86allseries()
87{
88        $curlbin -o - $URL"serie-alphabet" | 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
109staffel()
110{
111        $curlbin -o - $URL$PARAM | awk -v PARAM=$PARAM -v SRC=$SRC -v NAME=$NAME '
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{
129        $curlbin -o - $URL$PARAM | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
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 != "") {
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"
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
187hosterlist()
188{
189        $curlbin -o - $URL$PARAM | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
190BEGIN { in_hosterlist = 0
191        url = ""
192        title = ""
193      }
194
195/<h3>Hoster dieser Episode<\/h3>/ { in_hosterlist = 1
196                                    next
197                                  }
198
199/href=\"/ { if (in_hosterlist == 1) {
200               i = index($0, "href=\"") + 6
201               j = index(substr($0, i), "\">") - 1
202               url = substr($0, i, j)
203            }
204            next
205          }
206
207/<\/span> / { if (in_hosterlist == 1) {
208                 i = index($0, "</span> ") + 8
209                 j = index(substr($0, i), "</a>") - 1
210                 title = substr($0, i, j)
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"
216              }
217              next
218            }
219
220/<\/ul>/ { in_hosterlist = 0
221          next
222        }
223
224' >/tmp/tithek/$PARSER.hosterlist.list
225        echo "/tmp/tithek/$PARSER.hosterlist.list"
226}
227
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;"/>
249
250
251#function followlocation()
252#{
253#       system("curlbin -s -D - $1 | grep Location: | tail -n1")
254#}
255
256hoster()
257{
258        $curlbin -o - $URL$PARAM | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
259BEGIN { in_hosterlist = 0
260        url = ""
261        title = ""
262      }
263
264/<iframe scrolling=/ { in_hoster_iframe = 1
265                               prew
266                             }
267
268/src=/ { if (in_hoster_iframe == 1) {
269                  i = index($0, "src=") + 5
270                  j = index(substr($0, i), ">") - 2
271                  url = substr($0, i, j)
272                  i = index($0, "<a href=\"") + 16
273                  j = index(substr($0, i), "/") - 1
274                  title = substr($0, i, j)
275
276#                  print "Originalvideo#" url "#http://atemio.dyndns.tv/mediathek/menu/default.jpg#default.jpg#" NAME "#140"
277#                  print title "#" url "#http://atemio.dyndns.tv/mediathek/menu/" title ".jpg#" title ".jpg#" NAME "#14"
278                  print url
279               }
280               next
281             }
282
283/<div id=\"video_actions\">/ { in_hoster = 1
284                               next
285                             }
286
287/<a href=\"/ { if (in_hoster == 1 && in_hoster_iframe == 0) {
288                  i = index($0, "<a href=\"") + 9
289                  j = index(substr($0, i), "\"") - 1
290                  url = substr($0, i, j)
291
292                  i = index($0, "<a href=\"") + 16
293                  j = index(substr($0, i), "/") - 1
294                  title = substr($0, i, j)
295
296#                  print "Originalvideo#" url "#http://atemio.dyndns.tv/mediathek/menu/default.jpg#default.jpg#" NAME "#140"
297#                  print title "#" url "#http://atemio.dyndns.tv/mediathek/menu/" title ".jpg#" title ".jpg#" NAME "#14"
298
299tmp = "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"
300#tmp = "curl -s -D - " url " | grep Location: | tail -n1"
301
302                                        while ((tmp | getline) > 0)
303                                           print
304                                           #print tmp
305                                           #print $0
306                                       
307                                        close(tmp)
308               }
309               next
310             }
311
312/<\/div>/ { in_hoster = 0
313                        in_hoster_iframe = 0
314            next
315          }
316
317' >/tmp/tithek/$PARSER.hoster.list
318#       echo "/tmp/tithek/$PARSER.hoster.list"
319        cat     "/tmp/tithek/$PARSER.hoster.list"
320}
321
322case $INPUT in
323        init) $INPUT;;
324        mainmenu) $INPUT;;
325        genres) $INPUT;;
326        series) $INPUT;;
327        allseries) $INPUT;;
328        staffel) $INPUT;;
329        episode) $INPUT;;
330        hosterlist) $INPUT;;
331        hoster) $INPUT;;
332esac
333
Note: See TracBrowser for help on using the repository browser.