source: titan/mediathek/localparser_secret/myspass.sh @ 44502

Last change on this file since 44502 was 44502, checked in by obi, 4 years ago

optimize tithek start

  • Property svn:executable set to *
File size: 12.6 KB
Line 
1#!/bin/sh
2# first sh box parser for titannit mfg obi
3
4SRC=$1
5INPUT=$2
6PAGE=$3
7NEXT=$4
8PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'`
9
10#URL=http://www.myspass.de
11URL=http://m.myspass.de
12NAME="MySpass"
13
14case $2 in
15        init) echo skip load hoster.sh;;
16        *)      . /tmp/localhoster/hoster.sh
17                mkdir $TMP > /dev/null 2>&1
18                FILENAME="$PARSER $INPUT $PAGE $NEXT $PAGE2"
19                FILENAME=$(echo $FILENAME | tr '&' '.' | tr '/' '.' | tr '?' '.' | tr '=' '.' | sed -e 's/\&\+/./g' -e 's#\/\+#.#g' -e 's/\?\+/./g' -e 's/;\+/./g' -e 's/=\+/./g' -e 's/ \+/./g' -e 's/\.\+/./g')
20                if [ -z "$FILENAME" ]; then FILENAME=none;fi
21                PICNAME="$FILENAME"
22                ;;
23esac
24
25if [ `echo $SRC | grep ^"/mnt/parser" | wc -l` -gt 0 ];then
26        TYPE="$SRC - Shell script"
27elif [ `echo $SRC | grep ^"/var/swap" | wc -l` -gt 0 ];then
28        TYPE="Swap - Shell script"
29elif [ `echo $SRC | grep ^"/mnt/swapextensions" | wc -l` -gt 0 ];then
30        TYPE="Mnt - Shell script"
31else
32        TYPE="Flash - Shell script"
33fi
34
35init()
36{
37        rm -rf $TMP > /dev/null 2>&1
38        echo "$NAME ($TYPE)#$SRC $SRC mainmenu#http://atemio.dyndns.tv/mediathek/menu/$PARSER.jpg#$PARSER.jpg#TiThek#0"
39}
40
41mainmenu()
42{
43        echo "Ganze Folgen#$SRC $SRC season 'api/index.php?command=formats' 1#http://atemio.dyndns.tv/mediathek/menu/shows.jpg#shows.jpg#$NAME#0" >$TMP/$FILENAME.list
44        echo "Suchen#$SRC $SRC search 'frontend/json/search-videos.php?QUERY_STRING=%search%' 1#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#$NAME#112" >>$TMP/$FILENAME.list
45        echo "$TMP/$FILENAME.list"
46}
47
48season()
49{
50        rm "$TMP/$FILENAME.list"
51
52        if [ ! -e "$TMP/$FILENAME.list" ]; then
53                $curlbin -o - $URL/$PAGE | sed 's/{"format_id":/\n{"format_id":/g' | awk -v SRC=$SRC -v NAME=$NAME -v PICNAME=$PICNAME -v INPUT=$INPUT -v PAGE=$PAGE -v NEXT=$NEXT \
54                '
55                        # BEGIN variable setzen
56                        BEGIN \
57                        {
58                                # setzt suchvariable auf 0 vor dem start
59                                piccount = 0
60                                pages = "1"
61                        }
62                        /"format_id"/ \
63                        {
64                                i = index($0, "\"format_id\":\"") + 13
65                                j = index(substr($0, i), "\",\"") - 1
66                                id = substr($0, i, j)
67
68                                i = index($0, "\"format\":\"") + 10
69                                j = index(substr($0, i), "\",\"") - 1
70                                title = substr($0, i, j)
71
72                                i = index($0, "\"number_of_seasons\":\"") + 21
73                                j = index(substr($0, i), "\",\"") - 1
74                                extra = substr($0, i, j)
75
76                                i = index($0, "\"node_id\":\"") + 11
77                                j = index(substr($0, i), "\"") - 1
78                                newpage = substr($0, i, j)
79                                gsub(/\\/, "", newpage)
80
81                                i = index($0, "\"original_image\":\"") + 18
82                                j = index(substr($0, i), "\"") - 1
83                                pic = substr($0, i, j)
84                                gsub(/\\/, "", pic)
85
86                                piccount += 1
87                                if ( pic == "" )
88                                {
89                                        pic = "http://atemio.dyndns.tv/mediathek/menu/default.jpg"
90                                }
91                                else
92                                        pic = "http:" pic
93
94                                print title " (" extra " Staffeln)#" SRC " " SRC " year \x27api/index.php?command=seasonslist&id=" id "\x27#" pic "#" PICNAME "." piccount ".jpg#" NAME "#0"
95
96                                next
97                        }
98                        END \
99                        {
100                                if (curpage != pages)
101                                        print "Page (" NEXT + 1 "/" pages ")#" SRC " " SRC " " INPUT " \x27" PAGE "\x27 " NEXT + 1 "#http://atemio.dyndns.tv/mediathek/menu/next.jpg#next.jpg#" NAME "#0"
102                        }
103                # schreibe alles in die list datei
104                ' >$TMP/$FILENAME.list
105        fi
106        # gebe titan den list namen mit pfad zurueck
107        echo "$TMP/$FILENAME.list"
108}
109
110year()
111{
112        if [ ! -e "$TMP/$FILENAME.list" ]; then
113                $curlbin -o - $URL/$PAGE | sed 's/{"season_id":/\n{"season_id":/g' | awk -v SRC=$SRC -v NAME=$NAME -v PICNAME=$PICNAME -v INPUT=$INPUT -v PAGE=$PAGE -v NEXT=$NEXT \
114                '
115                        # BEGIN variable setzen
116                        BEGIN \
117                        {
118                                # setzt suchvariable auf 0 vor dem start
119                                piccount = 0
120                                pages = "1"
121                        }
122                        /"season_id"/ \
123                        {
124                                i = index($0, "\"season_id\":\"") + 13
125                                j = index(substr($0, i), "\",\"") - 1
126                                id = substr($0, i, j)
127
128                                i = index($0, "\"season_number\":\"") + 17
129                                j = index(substr($0, i), "\",\"") - 1
130                                title = substr($0, i, j)
131
132                                i = index($0, "\"season_name\":\"") + 15
133                                j = index(substr($0, i), "\",\"") - 1
134                                extra = substr($0, i, j)
135
136                                i = index($0, "\"node_id\":\"") + 11
137                                j = index(substr($0, i), "\"") - 1
138                                newpage = substr($0, i, j)
139                                gsub(/\\/, "", newpage)
140
141                                i = index($0, "\"original_image\":\"") + 18
142                                j = index(substr($0, i), "\"") - 1
143                                pic = substr($0, i, j)
144                                gsub(/\\/, "", pic)
145
146                                piccount += 1
147                                if ( pic == "" )
148                                {
149                                        pic = "http://atemio.dyndns.tv/mediathek/menu/default.jpg"
150                                }
151                                else
152                                        pic = "http:" pic
153
154                                print "Staffel " title " (" extra ")#" SRC " " SRC " episodes \x27api/index.php?command=seasonepisodes&id=" id "\x27#" pic "#" PICNAME "." piccount ".jpg#" NAME "#0"
155
156                                next
157                        }
158                        END \
159                        {
160                                if (curpage != pages)
161                                        print "Page (" NEXT + 1 "/" pages ")#" SRC " " SRC " " INPUT " \x27" PAGE "\x27 " NEXT + 1 "#http://atemio.dyndns.tv/mediathek/menu/next.jpg#next.jpg#" NAME "#0"
162                        }
163                # schreibe alles in die list datei
164                ' >$TMP/$FILENAME.list
165        fi
166        # gebe titan den list namen mit pfad zurueck
167        echo "$TMP/$FILENAME.list"
168}
169
170episodes()
171{
172        if [ ! -e "$TMP/$FILENAME.list" ]; then
173                $curlbin -o - $URL/$PAGE | sed 's/{"format":/\n{"format":/g' | awk -v SRC=$SRC -v NAME=$NAME -v PICNAME=$PICNAME -v INPUT=$INPUT -v PAGE=$PAGE -v NEXT=$NEXT \
174                '
175                        # BEGIN variable setzen
176                        BEGIN \
177                        {
178                                # setzt suchvariable auf 0 vor dem start
179                                piccount = 0
180                                pages = "1"
181                        }
182                        /"format"/ \
183                        {
184                                i = index($0, "\"episode_id\":\"") + 14
185                                j = index(substr($0, i), "\",\"") - 1
186                                id = substr($0, i, j)
187
188                                i = index($0, "\"title\":\"") + 9
189                                j = index(substr($0, i), "\",\"") - 1
190                                title = substr($0, i, j)
191                                gsub(" - Teil 1", "", title)
192
193                                i = index($0, "\"season_name\":\"") + 15
194                                j = index(substr($0, i), "\",\"") - 1
195                                extra = substr($0, i, j)
196
197                                i = index($0, "\"season_number\":\"") + 17
198                                j = index(substr($0, i), "\",\"") - 1
199                                season = substr($0, i, j)
200
201                                i = index($0, "\"episode_nr\":\"") + 14
202                                j = index(substr($0, i), "\",\"") - 1
203                                episode = substr($0, i, j)
204
205                                i = index($0, "\"myspass_url\":\"") + 15
206                                j = index(substr($0, i), "\"") - 1
207                                newpage = substr($0, i, j)
208                                gsub(/\\/, "", newpage)
209
210                                i = index($0, "\"original_image\":\"") + 18
211                                j = index(substr($0, i), "\"") - 1
212                                pic = substr($0, i, j)
213                                gsub(/\\/, "", pic)
214
215                                piccount += 1
216                                if ( pic == "" )
217                                {
218                                        pic = "http://atemio.dyndns.tv/mediathek/menu/default.jpg"
219                                }
220                                print "S" season "E" episode " - " title "#" SRC " " SRC " parts \x27" newpage "\x27#http:" pic "#" PICNAME "." piccount ".jpg#" NAME "#0"
221
222                                next
223                        }
224                        END \
225                        {
226                                if (curpage != pages)
227                                        print "Page (" NEXT + 1 "/" pages ")#" SRC " " SRC " " INPUT " \x27" PAGE "\x27 " NEXT + 1 "#http://atemio.dyndns.tv/mediathek/menu/next.jpg#next.jpg#" NAME "#0"
228                        }
229                # schreibe alles in die list datei
230                ' >$TMP/$FILENAME.list
231        fi
232        # gebe titan den list namen mit pfad zurueck
233        echo "$TMP/$FILENAME.list"
234}
235
236search()
237{
238        if [ ! -e "$TMP/$FILENAME.list" ]; then
239                $curlbin -o - $URL/$PAGE | sed 's/{"uniqueID":/\n{"uniqueID":/g' | awk -v SRC=$SRC -v NAME=$NAME -v PICNAME=$PICNAME -v INPUT=$INPUT -v PAGE=$PAGE -v NEXT=$NEXT \
240                '
241                        # BEGIN variable setzen
242                        BEGIN \
243                        {
244                                # setzt suchvariable auf 0 vor dem start
245                                piccount = 0
246                                pages = "1"
247                        }
248                        /"uniqueID"/ \
249                        {
250#                               print "1111111" $0
251                                i = index($0, "\"title\":\"") + 9
252                                j = index(substr($0, i), "\",\"") - 1
253                                title = substr($0, i, j)
254#                               print "title: " title
255
256                                i = index($0, "\"broadcast\":\"") + 13
257                                j = index(substr($0, i), "\",\"") - 1
258                                extra = substr($0, i, j)
259#                               print "extra: " extra
260
261                                i = index($0, "\"url\":\"") + 7
262                                j = index(substr($0, i), "\"") - 1
263                                newpage = substr($0, i, j)
264                                gsub(/\\/, "", newpage)
265
266#                               print "newpage: " newpage
267
268                                i = index($0, "\"teaser\":\"") + 10
269                                j = index(substr($0, i), "\"") - 1
270                                pic = substr($0, i, j)
271                                gsub(/\\/, "", pic)
272#                               print "pic: " pic
273
274                                piccount += 1
275                                if ( pic == "" )
276                                {
277                                        pic = "http://atemio.dyndns.tv/mediathek/menu/default.jpg"
278                                }
279                                print title " (" extra ")#" SRC " " SRC " hoster \x27" newpage "\x27#" pic "#" PICNAME "." piccount ".jpg#" NAME "#111"
280                                next
281                        }
282                        END \
283                        {
284                                if (curpage != pages)
285                                        print "Page (" NEXT + 1 "/" pages ")#" SRC " " SRC " " INPUT " \x27" PAGE "\x27 " NEXT + 1 "#http://atemio.dyndns.tv/mediathek/menu/next.jpg#next.jpg#" NAME "#0"
286                        }
287                # schreibe alles in die list datei
288                ' >$TMP/$FILENAME.list
289        fi
290        # gebe titan den list namen mit pfad zurueck
291        echo "$TMP/$FILENAME.list"
292}
293
294hoster()
295{
296        echo $URL$PAGE
297}
298
299play()
300{
301        echo $URL$PAGE
302}
303
304parts()
305{
306        rm $TMP/$FILENAME.list
307        if [ ! -e "$TMP/$FILENAME.list" ]; then
308                FOUND=`echo $PAGE | sed 's/Teil/\n/g' | grep ^http | sed 's!http://www.myspass.de/myspass!!g' | sed 's!http://www.myspass.de!!g'`
309#               IDLIST=`$curlbin "$PAGE" | grep "$FOUND" | sed 's/<a href=/\nfound=/g' | grep ^found= | grep title= | grep -v myspassTeaserTextDesc | cut -d '"' -f2 | sort -u | tr '/' ' ' | awk '{ print $NF }'`
310                IDLIST=`$curlbin "$PAGE" | grep "$FOUND"| sed 's/<a href=/\nfound=/g' | grep ^found= | tr -d ' ' | cut -d "/" -f6 | sort -u`
311#echo idlist $IDLIST
312                for ROUND in $IDLIST; do
313                        $curlbin http://www.myspass.de/includes/apps/video/getvideometadataxml.php?id=$ROUND > "$TMP/cache.$FILENAME.$ROUND.1"
314                       
315                        #       <title><![CDATA[23. September 2006 - Teil 1]]></title>
316                        #       <url_flv><![CDATA[http://x3583brainc11021.s.o.l.lb.core-cdn.net/secdl/9b7b49482bf7ba65145bc28c6c3ac7b5/58ea7331/11021brainpool/ondemand/3583brainpool/163840/myspass2009/82/578/9231/12073/12073_61.mp4]]></url_flv>
317                        #       <imagePreview><![CDATA[//www.myspass.de/myspass/media/images/videos/73/12073_640x360.jpg]]></imagePreview>
318
319                        TITLE="`cat $TMP/cache.$FILENAME.$ROUND.1 | sed 's/<title><!\[CDATA\[/\nfound=\]/g' | grep ^found= | cut -d"]" -f2`"
320                        NEWPAGE="`cat $TMP/cache.$FILENAME.$ROUND.1 | sed 's/<url_flv><!\[CDATA\[/\nfound=\]/g' | grep ^found= | cut -d"]" -f2`"
321
322#<id><![CDATA[29870]]></id>
323#<format_id><![CDATA[104]]></format_id>
324#<season_id><![CDATA[836]]></season_id>
325
326#https://cldf-od.r53.cdn.tv1.eu/secdl/aa257d4ea8f9de7da13100c6e915a3c0/5e0d413e/11021brainpool/ondemand/3583brainpool/163840/myspass2009/104/24971320/355453000/892216900/892216900_61.mp4
327
328#https://cldf-od.r53.cdn.tv1.eu/secdl/aa257d4ea8f9de7da13100c6e915a3c0/5e0d413e/11021brainpool/ondemand/3583brainpool/163840/myspass2009/104/836/11905/29870/29870_61.mp4
329
330#https://cldf-od.r53.cdn.tv1.eu/secdl/5e6d2242be7cca293dc96d629127fa69/5e0d428f/11021brainpool/ondemand/3583brainpool/163840/myspass2009/104/836/11900/29870/29870_61.mp4
331
332#sed -nr 's/.*myspass.*\/.*\/([.*]+)\/.*/\1/p'
333#sed -nr 's/.*src="([^"]+)".*/\1/p'
334#echo https://cldf-od.r53.cdn.tv1.eu/secdl/aa257d4ea8f9de7da13100c6e915a3c0/5e0d413e/11021brainpool/ondemand/3583brainpool/163840/myspass2009/104/24971320/355453000/892216900/892216900_61.mp4 | sed -nr 's/.*myspass.*\/.*\/(.*+)\/.*/\1/p'
335#echo https://cldf-od.r53.cdn.tv1.eu/secdl/aa257d4ea8f9de7da13100c6e915a3c0/5e0d413e/11021brainpool/ondemand/3583brainpool/163840/myspass2009/104/24971320/355453000/892216900/892216900_61.mp4 | sed -nr 's/.*myspass.*\/.*\/(.*+)\/.*/\1/p'
336#echo https://cldf-od.r53.cdn.tv1.eu/secdl/aa257d4ea8f9de7da13100c6e915a3c0/5e0d413e/11021brainpool/ondemand/3583brainpool/163840/myspass2009/104/24971320/355453000/892216900/892216900_61.mp4 | sed -nr 's/.*myspass.*\/(.*+)\/.*/\1/p'
337
338ID_DUMMY=$(echo $NEWPAGE | sed -nr 's/.*myspass.*\/.*\/(.*+)\/.*/\1/p')
339EXTRAID_DUMMY=$(echo $NEWPAGE | sed -nr 's/.*myspass.*\/(.*+)\/.*\/.*/\1/p')
340SEASONID_DUMMY=$(echo $NEWPAGE | sed -nr 's/.*myspass.*\/(.*+)\/.*\/.*\/.*/\1/p')
341EXTRAID=$(expr $EXTRAID_DUMMY / $ROUND)
342SEASONID=$(cat $TMP/cache.$FILENAME.$ROUND.1 | sed -nr 's/.*season_id.*\[CDATA\[(.*+)].*].*/\1/p')
343
344#echo ID_DUMMY $ID_DUMMY
345#echo EXTRAID_DUMMY $EXTRAID_DUMMY
346#echo SEASONID_DUMMY $SEASONID_DUMMY
347#echo EXTRAID $EXTRAID
348#echo SEASONID $SEASONID
349#echo NEWPAGE $NEWPAGE
350
351NEWPAGE=$(echo $NEWPAGE | sed "s!/$ID_DUMMY\_!/$ROUND\_!")
352#echo NEWPAGE1 $NEWPAGE
353NEWPAGE=$(echo $NEWPAGE | sed "s!/$ID_DUMMY/!/$ROUND/!")
354#echo NEWPAGE2 $NEWPAGE
355NEWPAGE=$(echo $NEWPAGE | sed "s!/$EXTRAID_DUMMY/!/$EXTRAID/!")
356#echo NEWPAGE3 $NEWPAGE
357NEWPAGE=$(echo $NEWPAGE | sed "s!/$SEASONID_DUMMY/!/$SEASONID/!")
358#echo NEWPAGE4 $NEWPAGE
359
360                        PIC="http:`cat $TMP/cache.$FILENAME.$ROUND.1 | sed 's/<imagePreview><!\[CDATA\[/\nfound=\]/g' | grep ^found= | cut -d"]" -f2`"
361
362                        if [ -z "$PIC" ] || "$PIC" = "http:" ] ; then
363                                PIC="http://atemio.dyndns.tv/mediathek/menu/default.jpg"
364                        fi
365
366                        echo "$TITLE#$NEWPAGE#$PIC#$PICNAME$piccount.jpg#$NAME#2" >> $TMP/$FILENAME.list
367
368                done
369        fi
370
371        echo "$TMP/$FILENAME.list"
372}
373
374case $INPUT in
375        init) $INPUT;;
376        mainmenu) $INPUT;;
377        search) $INPUT;;
378        season) $INPUT;;
379        year) $INPUT;;
380        episodes) $INPUT;;
381        play) $INPUT;;
382        parts) $INPUT;;
383esac
Note: See TracBrowser for help on using the repository browser.