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

Last change on this file since 37438 was 37156, checked in by obi, 8 years ago

fix

  • Property svn:executable set to *
File size: 7.9 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="http://bs.to/"
11PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'`
12NAME="burningseries"
13
14rm -rf $TMP > /dev/null 2>&1
15mkdir $TMP > /dev/null 2>&1
16
17if [ `echo $SRC | grep ^"/mnt/parser" |wc -l` -gt 0 ];then
18        TYPE="$SRC - Shell script"
19elif [ `echo $SRC | grep ^"/var/swap" | wc -l` -gt 0 ];then
20        TYPE="Swap - Shell script"
21elif [ `echo $SRC | grep ^"/mnt/swapextensions" | wc -l` -gt 0 ];then
22        TYPE="Mnt - Shell script"
23else
24        TYPE="Flash - Shell script"
25fi
26
27init()
28{
29        echo "Burning Series ($TYPE)#$SRC $SRC mainmenu#http://atemio.dyndns.tv/mediathek/menu/$PARSER.jpg#$PARSER.jpg#TiThek#0"
30}
31
32mainmenu()
33{
34        echo "Genres#$SRC $SRC genres#http://atemio.dyndns.tv/mediathek/menu/serien.genre.jpg#serien.genre.jpg#$NAME#0" >/tmp/tithek/$PARSER.mainmenu.list
35        echo "All Series#$SRC $SRC allseries#http://atemio.dyndns.tv/mediathek/menu/serien.jpg#serien.jpg#$NAME#0" >>/tmp/tithek/$PARSER.mainmenu.list
36        echo "Search#$SRC $SRC search#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#$NAME#0" >>/tmp/tithek/$PARSER.mainmenu.list
37        echo "/tmp/tithek/$PARSER.mainmenu.list"
38}
39
40genres()
41{
42        $wgetbin $URL"andere-serien" -O - | awk -v SRC=$SRC -v NAME=$NAME '
43BEGIN { in_genres = 0
44      }
45
46/<div class="genre">/ { in_genres = 1
47                        next
48                      }
49
50/<span><strong>/ { i = index($0, "<span><strong>") + 14
51                   j = index($0, "</strong></span>") - i
52                   title = substr($0, i, j)
53                   pic = tolower(title)
54                   print title "#" SRC " " SRC " series " title "#http://atemio.dyndns.tv/mediathek/menu/" pic ".jpg#" pic ".jpg#" NAME "#0"
55                   next
56                 }
57                 
58' >/tmp/tithek/$PARSER.genres.list
59        echo "/tmp/tithek/$PARSER.genres.list"
60}
61
62series()
63{
64        $wgetbin $URL"andere-serien" -O - | awk -v PARAM=$PARAM -v SRC=$SRC -v NAME=$NAME '
65/<span><strong>/ { i = index($0, "<span><strong>") + 14
66                   j = index($0, "</strong></span>") - i
67                   genre = substr($0, i, j)
68                 }
69
70/<li><a href=\"/ { if (genre == PARAM) {
71                      i = index($0, "<li><a href=\"") + 13
72                      j = index(substr($0, i), "\">") - 1
73                      url = substr($0, i, j)
74                      k = i + j + 2
75                      l = index(substr($0, k), "</a></li>") - 1
76                      title = substr($0, k, l)
77                      print title "#" SRC " " SRC " staffel " url "#http://atemio.dyndns.tv/mediathek/menu/default.jpg#default.jpg#" NAME "#0"
78                   }
79                   next
80                 }
81' >/tmp/tithek/$PARSER.series.list
82        echo "/tmp/tithek/$PARSER.series.list"
83}
84
85staffel()
86{
87        $wgetbin $URL$PARAM -O - | awk -v PARAM=$PARAM -v SRC=$SRC -v NAME=$NAME '
88/<li class=\" current\">/ { sub(/<li class=\" current\">/, "<li class=\" \">", $0)
89                          }
90
91/<li class=\" \"><a href="/ { i = index($0, "<li class=\" \"><a href=\"") + 23
92                              j = index(substr($0, i), "\">") - 1
93                              url = substr($0, i, j)
94                              k = i + j + 2
95                              l = index(substr($0, k), "</a></li>") - 1
96                              staffel = substr($0, k, l)
97                              print "Staffel " staffel "#" SRC " " SRC " episode " url " " staffel "#http://atemio.dyndns.tv/mediathek/menu/s" staffel ".jpg#s" staffel ".jpg#" NAME "#0"
98                            }
99' >/tmp/tithek/$PARSER.staffel.list
100        echo "/tmp/tithek/$PARSER.staffel.list"
101}
102
103episode()
104{
105        $wgetbin $URL$PARAM -O - | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
106BEGIN { in_table_row = 0
107        episode = ""
108        url = ""
109        title = ""
110      }
111/<tr>/ { in_table_row = 1
112         next
113       }
114/<td><a href=\"/ { if (in_table_row == 1) {
115                      i = index($0, "<td><a href=\"") + 13
116                      j = index(substr($0, i), "\">") - 1
117                      url = substr($0, i, j)
118                   }
119                   next
120                 }
121
122/<td>/ { if (in_table_row == 1) {
123            i = index($0, "<td>") + 4
124            j = index(substr($0, i), "</td>") - 1
125            episode = substr($0, i, j)
126         }
127         next
128       }
129
130/<strong>/ { if (in_table_row == 1) {
131                i = index($0, "<strong>") + 8
132                j = index(substr($0, i), "</strong>") - 1
133                title = substr($0, i, j)
134                do {
135                   i = match(title, /&#[0-2][0-9][0-9];/)
136                   if (i != 0) {
137                      j = substr(title, i + 2, 3) * 1
138                      title = substr(title, 1, i - 1) sprintf("%c", j) substr(title, i + 6)
139                   }
140                } while(i != 0)
141             }
142             next
143           }
144
145/<\/tr>/ { if (in_table_row == 1) {
146             if (episode != "") {
147                print title "#" SRC " " SRC " hosterlist " url "#http://atemio.dyndns.tv/mediathek/menu/s" PARAM2 "e" episode ".jpg#s" PARAM2 "e" episode ".jpg#" NAME "#0"
148                title = ""
149                url = ""
150                episode = ""
151             }
152             in_table_row = 0
153          }
154          next
155        }
156
157/<li class=\" current\">/ { sub(/<li class=\" current\">/, "<li class=\" \">", $0)
158                          }
159' >/tmp/tithek/$PARSER.episode.list
160        echo "/tmp/tithek/$PARSER.episode.list"
161}
162
163hosterlist()
164{
165        $wgetbin $URL$PARAM -O - | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
166BEGIN { in_hosterlist = 0
167        url = ""
168        title = ""
169      }
170
171/<h3>Hoster dieser Episode<\/h3>/ { in_hosterlist = 1
172                                    next
173                                  }
174
175/href=\"/ { if (in_hosterlist == 1) {
176               i = index($0, "href=\"") + 6
177               j = index(substr($0, i), "\">") - 1
178               url = substr($0, i, j)
179            }
180            next
181          }
182
183/<\/span> / { if (in_hosterlist == 1) {
184                 i = index($0, "</span> ") + 8
185                 j = index(substr($0, i), "</a>") - 1
186                 title = substr($0, i, j)
187                 i = index($0, "</span> ") + 8
188                 j = index(substr($0, i), " -") - 1
189                 pic = substr($0, i, j)
190                 pic = tolower(pic)
191                 print title "#" SRC " " SRC " hoster " url "#http://atemio.dyndns.tv/mediathek/menu/" pic ".jpg#" pic ".jpg#" NAME "#111"
192              }
193              next
194            }
195
196/<\/ul>/ { in_hosterlist = 0
197          next
198        }
199
200' >/tmp/tithek/$PARSER.hosterlist.list
201        echo "/tmp/tithek/$PARSER.hosterlist.list"
202}
203
204hoster()
205{
206        $wgetbin $URL$PARAM -O - | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
207BEGIN { in_hosterlist = 0
208        url = ""
209        title = ""
210      }
211
212/<div id=\"video_actions\">/ { in_hoster = 1
213                               next
214                             }
215
216/<a href=\"/ { if (in_hoster == 1) {
217                  i = index($0, "<a href=\"") + 9
218                  j = index(substr($0, i), "\"") - 1
219                  url = substr($0, i, j)
220
221                  i = index($0, "<a href=\"") + 16
222                  j = index(substr($0, i), "/") - 1
223                  title = substr($0, i, j)
224                 
225#                  print "Originalvideo#" url "#http://atemio.dyndns.tv/mediathek/menu/default.jpg#default.jpg#" NAME "#140"
226#                  print title "#" url "#http://atemio.dyndns.tv/mediathek/menu/" title ".jpg#" title ".jpg#" NAME "#14"
227                  print url
228               }
229               next
230             }
231
232/<\/div>/ { in_hoster = 0
233            next
234          }
235
236' >/tmp/tithek/$PARSER.hoster.list
237#       echo "/tmp/tithek/$PARSER.hoster.list"
238        cat     "/tmp/tithek/$PARSER.hoster.list"
239}
240
241case $INPUT in
242        init) $INPUT;;
243        mainmenu) $INPUT;;
244        genres) $INPUT;;
245        series) $INPUT;;
246        staffel) $INPUT;;
247        episode) $INPUT;;
248        hosterlist) $INPUT;;
249        hoster) $INPUT;;
250esac
251
Note: See TracBrowser for help on using the repository browser.