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

Last change on this file since 38389 was 37466, checked in by tt4sk, 8 years ago

fixed: burning series changed from http to https

  • 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="https://bs.to/"
11PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'`
12NAME="burningseries"
13curlbin="curl -k -s"
14
15rm -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
86staffel()
87{
88        $curlbin -o - $URL$PARAM | awk -v PARAM=$PARAM -v SRC=$SRC -v NAME=$NAME '
89/<li class=\" current\">/ { sub(/<li class=\" current\">/, "<li class=\" \">", $0)
90                          }
91
92/<li class=\" \"><a href="/ { i = index($0, "<li class=\" \"><a href=\"") + 23
93                              j = index(substr($0, i), "\">") - 1
94                              url = substr($0, i, j)
95                              k = i + j + 2
96                              l = index(substr($0, k), "</a></li>") - 1
97                              staffel = substr($0, k, l)
98                              print "Staffel " staffel "#" SRC " " SRC " episode " url " " staffel "#http://atemio.dyndns.tv/mediathek/menu/s" staffel ".jpg#s" staffel ".jpg#" NAME "#0"
99                            }
100' >/tmp/tithek/$PARSER.staffel.list
101        echo "/tmp/tithek/$PARSER.staffel.list"
102}
103
104episode()
105{
106        $curlbin -o - $URL$PARAM | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
107BEGIN { in_table_row = 0
108        episode = ""
109        url = ""
110        title = ""
111      }
112/<tr>/ { in_table_row = 1
113         next
114       }
115/<td><a href=\"/ { if (in_table_row == 1) {
116                      i = index($0, "<td><a href=\"") + 13
117                      j = index(substr($0, i), "\">") - 1
118                      url = substr($0, i, j)
119                   }
120                   next
121                 }
122
123/<td>/ { if (in_table_row == 1) {
124            i = index($0, "<td>") + 4
125            j = index(substr($0, i), "</td>") - 1
126            episode = substr($0, i, j)
127         }
128         next
129       }
130
131/<strong>/ { if (in_table_row == 1) {
132                i = index($0, "<strong>") + 8
133                j = index(substr($0, i), "</strong>") - 1
134                title = substr($0, i, j)
135                do {
136                   i = match(title, /&#[0-2][0-9][0-9];/)
137                   if (i != 0) {
138                      j = substr(title, i + 2, 3) * 1
139                      title = substr(title, 1, i - 1) sprintf("%c", j) substr(title, i + 6)
140                   }
141                } while(i != 0)
142             }
143             next
144           }
145
146/<\/tr>/ { if (in_table_row == 1) {
147             if (episode != "") {
148                print title "#" SRC " " SRC " hosterlist " url "#http://atemio.dyndns.tv/mediathek/menu/s" PARAM2 "e" episode ".jpg#s" PARAM2 "e" episode ".jpg#" NAME "#0"
149                title = ""
150                url = ""
151                episode = ""
152             }
153             in_table_row = 0
154          }
155          next
156        }
157
158/<li class=\" current\">/ { sub(/<li class=\" current\">/, "<li class=\" \">", $0)
159                          }
160' >/tmp/tithek/$PARSER.episode.list
161        echo "/tmp/tithek/$PARSER.episode.list"
162}
163
164hosterlist()
165{
166        $curlbin -o - $URL$PARAM | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
167BEGIN { in_hosterlist = 0
168        url = ""
169        title = ""
170      }
171
172/<h3>Hoster dieser Episode<\/h3>/ { in_hosterlist = 1
173                                    next
174                                  }
175
176/href=\"/ { if (in_hosterlist == 1) {
177               i = index($0, "href=\"") + 6
178               j = index(substr($0, i), "\">") - 1
179               url = substr($0, i, j)
180            }
181            next
182          }
183
184/<\/span> / { if (in_hosterlist == 1) {
185                 i = index($0, "</span> ") + 8
186                 j = index(substr($0, i), "</a>") - 1
187                 title = substr($0, i, j)
188                 i = index($0, "</span> ") + 8
189                 j = index(substr($0, i), " -") - 1
190                 pic = substr($0, i, j)
191                 pic = tolower(pic)
192                 print title "#" SRC " " SRC " hoster " url "#http://atemio.dyndns.tv/mediathek/menu/" pic ".jpg#" pic ".jpg#" NAME "#111"
193              }
194              next
195            }
196
197/<\/ul>/ { in_hosterlist = 0
198          next
199        }
200
201' >/tmp/tithek/$PARSER.hosterlist.list
202        echo "/tmp/tithek/$PARSER.hosterlist.list"
203}
204
205hoster()
206{
207        $curlbin -o - $URL$PARAM | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
208BEGIN { in_hosterlist = 0
209        url = ""
210        title = ""
211      }
212
213/<div id=\"video_actions\">/ { in_hoster = 1
214                               next
215                             }
216
217/<a href=\"/ { if (in_hoster == 1) {
218                  i = index($0, "<a href=\"") + 9
219                  j = index(substr($0, i), "\"") - 1
220                  url = substr($0, i, j)
221
222                  i = index($0, "<a href=\"") + 16
223                  j = index(substr($0, i), "/") - 1
224                  title = substr($0, i, j)
225                 
226#                  print "Originalvideo#" url "#http://atemio.dyndns.tv/mediathek/menu/default.jpg#default.jpg#" NAME "#140"
227#                  print title "#" url "#http://atemio.dyndns.tv/mediathek/menu/" title ".jpg#" title ".jpg#" NAME "#14"
228                  print url
229               }
230               next
231             }
232
233/<\/div>/ { in_hoster = 0
234            next
235          }
236
237' >/tmp/tithek/$PARSER.hoster.list
238#       echo "/tmp/tithek/$PARSER.hoster.list"
239        cat     "/tmp/tithek/$PARSER.hoster.list"
240}
241
242case $INPUT in
243        init) $INPUT;;
244        mainmenu) $INPUT;;
245        genres) $INPUT;;
246        series) $INPUT;;
247        staffel) $INPUT;;
248        episode) $INPUT;;
249        hosterlist) $INPUT;;
250        hoster) $INPUT;;
251esac
252
Note: See TracBrowser for help on using the repository browser.