source: titan/mediathek/localparser_secret/tvnow.sh @ 41989

Last change on this file since 41989 was 41989, checked in by obi, 2 years ago

update tvnow

  • Property svn:executable set to *
File size: 9.5 KB
Line 
1#!/bin/sh
2# first sh box parser for titannit mfg obi
3
4. /tmp/localhoster/hoster.sh
5
6SRC=$1
7INPUT=$2
8PAGE=$3
9NEXT=$4
10PAGE2=$5
11PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'`
12
13#FILENAME="$PARSER $INPUT $PAGE $NEXT $PAGE2"
14FILENAME="$PARSER $INPUT $NEXT $PAGE2"
15FILENAME=`echo $FILENAME | tr '&' '.' | tr '/' '.' | tr '?' '.'  | tr '=' '.' | sed 's/ \+/./g' | sed 's/\.\+/./g'`
16
17if [ -z "$FILENAME" ]; then
18        FILENAME=none
19fi
20
21URL=https://api.tvnow.de
22PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'`
23NAME="TvNow"
24
25mkdir $TMP > /dev/null 2>&1
26#TMP=/tmp/localcache
27if [ `echo $SRC | grep ^"/mnt/parser" | wc -l` -gt 0 ];then
28        TYPE="$SRC - Shell script"
29elif [ `echo $SRC | grep ^"/var/swap" | wc -l` -gt 0 ];then
30        TYPE="Swap - Shell script"
31elif [ `echo $SRC | grep ^"/mnt/swapextensions" | wc -l` -gt 0 ];then
32        TYPE="Mnt - Shell script"
33else
34        TYPE="Flash - Shell script"
35fi
36
37init()
38{
39        rm -rf $TMP > /dev/null 2>&1
40        echo "$NAME ($TYPE)#$SRC $SRC mainmenu#http://atemio.dyndns.tv/mediathek/menu/$PARSER.jpg#$PARSER.jpg#TiThek#0"
41}
42
43
44#nitro page=1
45#https://api.tvnow.de/v3/formats?fields=id,title,station,title,titleGroup,seoUrl,icon,hasFreeEpisodes,hasPayEpisodes,categoryId,searchAliasName,genres&filter=%7B%22Id%22:%7B%22containsNotIn%22:%5B%221896%22%5D%7D,%22Disabled%22:0%7D&maxPerPage=500&page=1&page=1
46
47#nitro page=4
48#https://api.tvnow.de/v3/formats?fields=id,title,station,title,titleGroup,seoUrl,icon,hasFreeEpisodes,hasPayEpisodes,categoryId,searchAliasName,genres&filter=%7B%22Id%22:%7B%22containsNotIn%22:%5B%221896%22%5D%7D,%22Disabled%22:0%7D&maxPerPage=500&page=1&page=4
49#36:
50#id     2500
51#title  "Matlock"
52#station        "nitro"
53#titleGroup     "M"
54#seoUrl "matlock"
55
56#matlock
57#https://api.tvnow.de/v3/formats/seo?fields=*,.*,formatTabs.*,formatTabs.formatTabPages.*,formatTabs.formatTabPages.container.*,annualNavigation.*&name=matlock.php&station=nitro
58#alle folgen
59#https://api.tvnow.de/v3/containers/141431/movies?fields=*,format.*,paymentPaytypes.*,livestreamEvent.*,pictures,trailers,packages,annualNavigation&maxPerPage=500&order=OrderWeight+asc,+BroadcastStartDate+desc&page=1
60#einzel folge
61#https://api.tvnow.de/v3/movies/matlock/der-alptraum?fields=*,format,files,manifest,breakpoints,paymentPaytypes,trailers,packages&station=nitro
62
63mainmenu()
64{
65        echo "Rtl#$SRC $SRC new 'v3/formats?fields=id,title,station,title,titleGroup,seoUrl,icon,hasFreeEpisodes,hasPayEpisodes,categoryId,searchAliasName,genres&filter=%7B%22Id%22:%7B%22containsNotIn%22:%5B%221896%22%5D%7D,%22Disabled%22:0%7D&maxPerPage=500&page=1' station rtl#http://atemio.dyndns.tv/mediathek/menu/rtl.jpg#rtl.jpg#$NAME#0" > $TMP/$PARSER.$INPUT.list
66        echo "Vox#$SRC $SRC new 'v3/formats?fields=id,title,station,title,titleGroup,seoUrl,icon,hasFreeEpisodes,hasPayEpisodes,categoryId,searchAliasName,genres&filter=%7B%22Id%22:%7B%22containsNotIn%22:%5B%221896%22%5D%7D,%22Disabled%22:0%7D&maxPerPage=500&page=1' station vox#http://atemio.dyndns.tv/mediathek/menu/vox.jpg#vox.jpg#$NAME#0" >> $TMP/$PARSER.$INPUT.list
67        echo "Rtl2#$SRC $SRC new 'v3/formats?fields=id,title,station,title,titleGroup,seoUrl,icon,hasFreeEpisodes,hasPayEpisodes,categoryId,searchAliasName,genres&filter=%7B%22Id%22:%7B%22containsNotIn%22:%5B%221896%22%5D%7D,%22Disabled%22:0%7D&maxPerPage=500&page=1' station rtl2#http://atemio.dyndns.tv/mediathek/menu/rtl2.jpg#rtl2.jpg#$NAME#0" >> $TMP/$PARSER.$INPUT.list
68        echo "Nitro#$SRC $SRC new 'v3/formats?fields=id,title,station,title,titleGroup,seoUrl,icon,hasFreeEpisodes,hasPayEpisodes,categoryId,searchAliasName,genres&filter=%7B%22Id%22:%7B%22containsNotIn%22:%5B%221896%22%5D%7D,%22Disabled%22:0%7D&maxPerPage=500&page=1' station nitro#http://atemio.dyndns.tv/mediathek/menu/nitro.jpg#nitro.jpg#$NAME#0" >> $TMP/$PARSER.$INPUT.list
69        echo "N-Tv#$SRC $SRC new 'v3/formats?fields=id,title,station,title,titleGroup,seoUrl,icon,hasFreeEpisodes,hasPayEpisodes,categoryId,searchAliasName,genres&filter=%7B%22Id%22:%7B%22containsNotIn%22:%5B%221896%22%5D%7D,%22Disabled%22:0%7D&maxPerPage=500&page=1' station ntv#http://atemio.dyndns.tv/mediathek/menu/ntv.jpg#ntv.jpg#$NAME#0" >> $TMP/$PARSER.$INPUT.list
70        echo "RTLplus#$SRC $SRC new 'v3/formats?fields=id,title,station,title,titleGroup,seoUrl,icon,hasFreeEpisodes,hasPayEpisodes,categoryId,searchAliasName,genres&filter=%7B%22Id%22:%7B%22containsNotIn%22:%5B%221896%22%5D%7D,%22Disabled%22:0%7D&maxPerPage=500&page=1' station rtlplus#http://atemio.dyndns.tv/mediathek/menu/rtlplus.jpg#rtlplus.jpg#$NAME#0" >> $TMP/$PARSER.$INPUT.list
71        echo "Super RTL#$SRC $SRC new 'v3/formats?fields=id,title,station,title,titleGroup,seoUrl,icon,hasFreeEpisodes,hasPayEpisodes,categoryId,searchAliasName,genres&filter=%7B%22Id%22:%7B%22containsNotIn%22:%5B%221896%22%5D%7D,%22Disabled%22:0%7D&maxPerPage=500&page=1' station superrtl#http://atemio.dyndns.tv/mediathek/menu/superrtl.jpg#superrtl.jpg#$NAME#0" >> $TMP/$PARSER.$INPUT.list
72        echo "WatchBox#$SRC $SRC new 'v3/formats?fields=id,title,station,title,titleGroup,seoUrl,icon,hasFreeEpisodes,hasPayEpisodes,categoryId,searchAliasName,genres&filter=%7B%22Id%22:%7B%22containsNotIn%22:%5B%221896%22%5D%7D,%22Disabled%22:0%7D&maxPerPage=500&page=1' station watchbox#http://atemio.dyndns.tv/mediathek/menu/watchbox.jpg#watchbox.jpg#$NAME#0" >> $TMP/$PARSER.$INPUT.list
73
74        if [ -e "$TMP/$PARSER.new.list" ] ; then
75                rm $TMP/$PARSER.new.list
76        fi
77        if [ -e "$TMP/$PARSER.page.list" ] ; then
78                rm $TMP/$PARSER.page.list
79        fi
80
81        echo "$TMP/$PARSER.$INPUT.list"
82}
83
84new()
85{
86        if [ ! -e "$TMP/$PARSER.$INPUT.sorted.list" ] ; then
87                $curlbin "$URL/$PAGE&page=1" > $TMP/cache.$PARSER.$INPUT.1
88                $curlbin "$URL/$PAGE&page=2" >> $TMP/cache.$PARSER.$INPUT.1
89                $curlbin "$URL/$PAGE&page=3" >> $TMP/cache.$PARSER.$INPUT.1
90                $curlbin "$URL/$PAGE&page=4" >> $TMP/cache.$PARSER.$INPUT.1
91                cat $TMP/cache.$PARSER.$INPUT.1  | sed 's/{"id":/\n{"id":/g' | grep ^'{"id":' | grep "\"$NEXT\":\"$PAGE2\"" > /$TMP/cache.$PARSER.$INPUT.2
92
93                while read -u 3 ROUND; do
94                        TITLE=`echo $ROUND | sed -nr 's/.*"title":"([^"]+).*/\1/p'`
95                        seoUrl=`echo $ROUND | sed -nr 's/.*"seoUrl":"([^"]+).*/\1/p'`
96                        titleGroup=`echo $ROUND | sed -nr 's/.*"titleGroup":"([^"]+).*/\1/p'`
97                        PIC=`echo $ROUND | sed 's!data-original=!\nsrc=!' | grep ^"src=" | cut -d '"' -f2`
98                        NEWPAGE="v3/formats/seo?fields=*,.*,formatTabs.*,formatTabs.formatTabPages.*,formatTabs.formatTabPages.container.*,annualNavigation.*&name=$seoUrl.php&station=$PAGE2"
99                        if [ -z  "$PIC" ]; then 
100                                PIC="http://atemio.dyndns.tv/mediathek/menu/default.jpg"
101                                TMPPIC="default.jpg"
102                        else
103                                TMPPIC=nowtv_`echo $PIC | tr '/' '\n' | tail -n1`
104                        fi
105
106                        if [ ! -z "$TITLE" ] && [ ! -z "$NEWPAGE" ];then
107                                if [ `cat $TMP/$PARSER.$INPUT.list | grep ^"$NEWPAGE" | wc -l` -eq 0 ];then
108                                        if [ ! -e $TMP/$PARSER.$INPUT.list ];then
109                                                touch $TMP/$PARSER.$INPUT.list
110                                        fi
111                                        LINE="$TITLE#$SRC $SRC videos '$NEWPAGE'#$PIC#$TMPPIC#$NAME#0"
112                                        echo "$LINE" >> $TMP/$PARSER.$INPUT.list
113                                fi
114                        fi
115                done 3<$TMP/cache.$PARSER.$INPUT.2
116                rm $TMP/cache.$PARSER.$INPUT.* > /dev/null 2>&1
117        fi
118
119        cat $TMP/$PARSER.$INPUT.list | sort -u > $TMP/$PARSER.$INPUT.sorted.list
120
121        if [ -e "$TMP/$PARSER.hosterlist.list" ] ; then
122                rm $TMP/$PARSER.hosterlist.list
123        fi
124
125#       echo "$TMP/$PARSER.$INPUT.list"
126        echo "$TMP/$PARSER.$INPUT.sorted.list"
127}
128
129videos()
130{
131        if [ ! -e "$TMP/$PARSER.$INPUT.list" ] ; then
132                $curlbin "$URL/$PAGE" > $TMP/cache.$PARSER.$INPUT.1
133                cat $TMP/cache.$PARSER.$INPUT.1 | sed -nr 's/.*"id":([^,]+).*/\1/p' > /$TMP/cache.$PARSER.$INPUT.2
134                ID=`cat $TMP/cache.$PARSER.$INPUT.2`
135                NEWPAGE="v3/containers/$ID/movies?fields=*,format.*,paymentPaytypes.*,livestreamEvent.*,pictures,trailers,packages,annualNavigation&maxPerPage=500&order=OrderWeight+asc,+BroadcastStartDate+desc&page=1"
136
137                $curlbin "$URL/$NEWPAGE" > $TMP/cache.$PARSER.$INPUT.3
138                cat $TMP/cache.$PARSER.$INPUT.3  | sed 's/orderWeight/\norderWeight/g' | grep ^orderWeight > /$TMP/cache.$PARSER.$INPUT.4
139
140                while read -u 3 ROUND; do
141                        TITLE=`echo $ROUND | sed 's/"title":/\ntitle=/g' | grep ^title= | head -n1 | cut -d'"' -f2`
142                        PIC=`echo $ROUND | sed -nr 's/.*"defaultDvdImage":"([^"]+).*/\1/p'`
143#                       dash working on sh4 libeplayer mipsel/arm need dash patch
144#                       NEWPAGE=`echo $ROUND | sed -nr 's/.*"dash":"([^"]+).*/\1/p'`
145                        NEWPAGE=`echo $ROUND | sed -nr 's/.*"hlsclear":"([^"]+).*/\1/p'`
146
147                        #NEWPAGE="https://vodnowusohls-a.akamaihd.net/proxy/clear/manifest/tvnow/417382-1-17915.ism/fairplay.m3u8?filter=(type%3d%3d%22audio%22)%7c%7c(type%3d%3d%22video%22%26%26systemBitrate%3c1550000)"
148                        PART1=$(echo "$NEWPAGE" | sed 's!fairplay.m3u8!\n!' | grep ^http)
149                        PART2=$(echo "$NEWPAGE" | sed -nr 's!.*/tvnow/([^.ism/]+).*!\1!p')
150                        #echo PART1 $PART1
151                        #echo PART2 $PART2
152
153                        #https://vodnowusohls.secure.footprint.net/proxy/clear/manifest/tvnow/417382-1-17915.ism/417382-1-17915-audio=128000-video=1400000.m3u8
154                        NEWPAGE=$PART1$PART2-audio=128000-video=1400000.m3u8
155
156                        if [ -z  "$PIC" ]; then 
157                                PIC="http://atemio.dyndns.tv/mediathek/menu/default.jpg"
158                                TMPPIC="default.jpg"
159                        else
160                                TMPPIC=nowtv_`echo $PIC | tr '/' '\n' | tail -n1`
161                        fi
162
163                        if [ ! -z "$TITLE" ] && [ ! -z "$NEWPAGE" ];then
164                                if [ `cat $TMP/$PARSER.$INPUT.list | grep ^"$NEWPAGE" | wc -l` -eq 0 ];then
165                                        if [ ! -e $TMP/$PARSER.$INPUT.list ];then
166                                                touch $TMP/$PARSER.$INPUT.list
167                                        fi
168                                        LINE="$TITLE#$NEWPAGE#$PIC#$TMPPIC#$NAME#2"
169                                        echo "$LINE" >> $TMP/$PARSER.$INPUT.list
170                                fi
171                        fi
172                done 3<$TMP/cache.$PARSER.$INPUT.4
173                rm $TMP/cache.$PARSER.$INPUT.* > /dev/null 2>&1
174        fi
175
176        if [ -e "$TMP/$PARSER.hosterlist.list" ] ; then
177                rm $TMP/$PARSER.hosterlist.list
178        fi
179
180        echo "$TMP/$PARSER.$INPUT.list"
181}
182
183case $INPUT in
184        init) $INPUT;;
185        mainmenu) $INPUT;;
186        new) $INPUT;;
187        videos) $INPUT;;
188esac
Note: See TracBrowser for help on using the repository browser.