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

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

tithek testfix speedup init localhoster

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