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

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

fix tvnow

  • Property svn:executable set to *
File size: 9.6 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## start filename work, filename to long
14LIST="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"
15TMPPAGE="$PAGE"
16for ROUND in $LIST; do
17        TMPPAGE=$(echo $TMPPAGE | sed "s/$ROUND/./g")
18done
19TMPPAGE=`echo $TMPPAGE | tr ':' '.' | tr '*' '.' | tr ',' '.' | tr '-' '.' | tr '%' '.' | tr '&' '.' | tr '/' '.' | tr '?' '.'  | tr '=' '.' | sed 's/ \+/./g' | sed 's/\.\+/./g'`
20## done
21
22#FILENAME="$PARSER $INPUT $PAGE $NEXT $PAGE2"
23FILENAME="$PARSER $INPUT $TMPPAGE $NEXT $PAGE2"
24FILENAME=`echo $FILENAME | tr '&' '.' | tr '/' '.' | tr '?' '.'  | tr '=' '.' | sed 's/ \+/./g' | sed 's/\.\+/./g'`
25
26if [ -z "$FILENAME" ]; then
27        FILENAME=none
28fi
29
30URL=https://api.tvnow.de
31PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'`
32NAME="TvNow"
33
34mkdir $TMP > /dev/null 2>&1
35#TMP=/tmp/localcache
36if [ `echo $SRC | grep ^"/mnt/parser" | wc -l` -gt 0 ];then
37        TYPE="$SRC - Shell script"
38elif [ `echo $SRC | grep ^"/var/swap" | wc -l` -gt 0 ];then
39        TYPE="Swap - Shell script"
40elif [ `echo $SRC | grep ^"/mnt/swapextensions" | wc -l` -gt 0 ];then
41        TYPE="Mnt - Shell script"
42else
43        TYPE="Flash - Shell script"
44fi
45
46init()
47{
48        rm -rf $TMP > /dev/null 2>&1
49        echo "$NAME ($TYPE)#$SRC $SRC mainmenu#http://atemio.dyndns.tv/mediathek/menu/$PARSER.jpg#$PARSER.jpg#TiThek#0"
50}
51
52
53#nitro page=1
54#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
55
56#nitro page=4
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=4
58#36:
59#id     2500
60#title  "Matlock"
61#station        "nitro"
62#titleGroup     "M"
63#seoUrl "matlock"
64
65#matlock
66#https://api.tvnow.de/v3/formats/seo?fields=*,.*,formatTabs.*,formatTabs.formatTabPages.*,formatTabs.formatTabPages.container.*,annualNavigation.*&name=matlock.php&station=nitro
67#alle folgen
68#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
69#einzel folge
70#https://api.tvnow.de/v3/movies/matlock/der-alptraum?fields=*,format,files,manifest,breakpoints,paymentPaytypes,trailers,packages&station=nitro
71
72mainmenu()
73{
74        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
75        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
76        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
77        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
78        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
79        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
80        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
81        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
82        echo "$TMP/$FILENAME.list"
83}
84
85new()
86{
87        if [ ! -e "$TMP/$FILENAME.sorted.list" ] ; then
88                $curlbin "$URL/$PAGE&page=1" > $TMP/cache.$FILENAME.1
89                $curlbin "$URL/$PAGE&page=2" >> $TMP/cache.$FILENAME.1
90                $curlbin "$URL/$PAGE&page=3" >> $TMP/cache.$FILENAME.1
91                $curlbin "$URL/$PAGE&page=4" >> $TMP/cache.$FILENAME.1
92                cat $TMP/cache.$FILENAME.1  | sed 's/{"id":/\n{"id":/g' | grep ^'{"id":' | grep "\"$NEXT\":\"$PAGE2\"" > /$TMP/cache.$FILENAME.2
93
94                while read -u 3 ROUND; do
95                        TITLE=`echo $ROUND | sed -nr 's/.*"title":"([^"]+).*/\1/p'`
96                        seoUrl=`echo $ROUND | sed -nr 's/.*"seoUrl":"([^"]+).*/\1/p'`
97                        titleGroup=`echo $ROUND | sed -nr 's/.*"titleGroup":"([^"]+).*/\1/p'`
98                        PIC=`echo $ROUND | sed 's!data-original=!\nsrc=!' | grep ^"src=" | cut -d '"' -f2`
99                        NEWPAGE="v3/formats/seo?fields=*,.*,formatTabs.*,formatTabs.formatTabPages.*,formatTabs.formatTabPages.container.*,annualNavigation.*&name=$seoUrl.php&station=$PAGE2"
100                        if [ -z  "$PIC" ]; then 
101                                PIC="http://atemio.dyndns.tv/mediathek/menu/default.jpg"
102                                TMPPIC="default.jpg"
103                        else
104                                TMPPIC=nowtv_`echo $PIC | tr '/' '\n' | tail -n1`
105                        fi
106
107                        if [ ! -z "$TITLE" ] && [ ! -z "$NEWPAGE" ];then
108                                if [ `cat $TMP/$FILENAME.list | grep ^"$NEWPAGE" | wc -l` -eq 0 ];then
109                                        if [ ! -e $TMP/$FILENAME.list ];then
110                                                touch $TMP/$FILENAME.list
111                                        fi
112                                        LINE="$TITLE#$SRC $SRC videos '$NEWPAGE'#$PIC#$TMPPIC#$NAME#0"
113                                        echo "$LINE" >> $TMP/$FILENAME.list
114                                fi
115                        fi
116                done 3<$TMP/cache.$FILENAME.2
117                rm $TMP/cache.$FILENAME.* > /dev/null 2>&1
118        fi
119
120        cat $TMP/$FILENAME.list | sort -u > $TMP/$FILENAME.sorted.list
121        if [ -e $TMP/$FILENAME.list ];then
122                rm $TMP/$FILENAME.list
123        fi
124
125#       echo "$TMP/$FILENAME.list"
126        echo "$TMP/$FILENAME.sorted.list"
127}
128
129videos()
130{
131        if [ ! -e "$TMP/$FILENAME.list" ] ; then
132                $curlbin "$URL/$PAGE" > $TMP/cache.$FILENAME.1
133                cat $TMP/cache.$FILENAME.1 | sed -nr 's/.*"id":([^,]+).*/\1/p' > /$TMP/cache.$FILENAME.2
134                ID=`cat $TMP/cache.$FILENAME.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.$FILENAME.3
138                cat $TMP/cache.$FILENAME.3  | sed 's/orderWeight/\norderWeight/g' | grep ^orderWeight > /$TMP/cache.$FILENAME.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/$FILENAME.list | grep ^"$NEWPAGE" | wc -l` -eq 0 ];then
165                                        if [ ! -e $TMP/$FILENAME.list ];then
166                                                touch $TMP/$FILENAME.list
167                                        fi
168                                        LINE="$TITLE#$NEWPAGE#$PIC#$TMPPIC#$NAME#2"
169                                        echo "$LINE" >> $TMP/$FILENAME.list
170                                fi
171                        fi
172                done 3<$TMP/cache.$FILENAME.4
173                rm $TMP/cache.$FILENAME.* > /dev/null 2>&1
174        fi
175
176        echo "$TMP/$FILENAME.list"
177}
178
179case $INPUT in
180        init) $INPUT;;
181        mainmenu) $INPUT;;
182        new) $INPUT;;
183        videos) $INPUT;;
184esac
Note: See TracBrowser for help on using the repository browser.