source: titan/mediathek/localhoster/hoster.sh @ 40404

Last change on this file since 40404 was 40404, checked in by obi, 5 years ago

more debug

  • Property svn:executable set to *
File size: 6.8 KB
Line 
1#!/bin/sh
2# first sh box hoster for titannit mfg obi
3
4TYPE=$1
5INPUT=$2
6
7INPUT=`echo $INPUT | sed 's!/Out/?s=!!g'`
8
9ARCH=`cat /etc/.arch`
10BOX=`cat /etc/model`
11TMP=/tmp/localcache
12CMD=/tmp/localhoster
13USERAGENT='Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Maxthon/4.4.7.3000 Chrome/30.0.1599.101 Safari/537.36'
14debuglevel=`cat /mnt/config/titan.cfg | grep debuglevel | cut -d"=" -f2`
15curlbin="curl -k -s -L --cookie /mnt/network/cookies --cookie-jar /mnt/network/cookies -A $USERAGENT"
16curlbin2='curl -k -s --cookie /mnt/network/cookies --cookie-jar /mnt/network/cookies'
17youtubebin="$CMD/lib/youtube_dl/__main__.py --no-check-certificate --cookies /mnt/network/cookies --user-agent '$USERAGENT' --format mp4 --restrict-filenames --ignore-errors -g"
18
19if [ "$debuglevel" == "99" ]; then curlbin="$curlbin -v"; fi
20if [ "$debuglevel" == "99" ]; then curlbin2="$curlbin2 -v"; fi
21#if [ "$debuglevel" == "99" ]; then youtubebin="$youtubebin --verbose"; fi
22
23wgetbin="wget -q -T2"
24
25BIN="$CMD"/bin/python."$ARCH"
26
27if [ ! -e "/tmp/localhoster/lib/python2.7/lib-dynload" ] && [ -e /tmp/localhoster/lib/python2.7/lib-dynload."$ARCH" ];then
28#       ln -fs /tmp/localhoster/lib/python2.7/lib-dynload."$ARCH" /tmp/localhoster/lib/python2.7/lib-dynload
29        mv -f /tmp/localhoster/lib/python2.7/lib-dynload."$ARCH" /tmp/localhoster/lib/python2.7/lib-dynload
30        rm -rf /tmp/localhoster/lib/python2.7/lib-dynload.*
31fi
32if [ ! -e "/tmp/localhoster/lib/libpython2.7.so.1.0" ] && [ -e /tmp/localhoster/lib/libpython2.7.so.1.0."$ARCH" ];then
33#       ln -fs /tmp/localhoster/lib/libpython2.7.so.1.0."$ARCH" /tmp/localhoster/lib/libpython2.7.so.1.0
34        mv -f /tmp/localhoster/lib/libpython2.7.so.1.0."$ARCH" /tmp/localhoster/lib/libpython2.7.so.1.0
35        rm -f /tmp/localhoster/lib/libpython2.7.so.1.0.*
36fi
37export PYTHONHOME=/tmp/localhoster
38export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/localhoster/lib
39
40if [ -e "$TMP/hoster.tar" ]; then rm -f $TMP/hoster.tar; fi
41if [ -e "$TMP/parser.tar" ]; then rm -f $TMP/parser.tar; fi
42
43if [ "$ARCH" == "sh4" ] && [ "$BOX" != "ufs912" ]; then
44        if [ -e "$CMD/lib/python2.7/lib-dynload.mipsel" ]; then rm -rf $CMD/lib/python2.7/lib-dynload.mipsel; fi
45        if [ -e "$CMD/lib/libpython2.7.so.1.0.mipsel" ]; then rm -rf $CMD/lib/libpython2.7.so.1.0.mipsel; fi
46        if [ -e "$CMD/lib/python2.7/lib-dynload.arm" ]; then rm -rf $CMD/lib/python2.7/lib-dynload.arm; fi
47        if [ -e "$CMD/lib/libpython2.7.so.1.0.arm" ]; then rm -rf $CMD/lib/libpython2.7.so.1.0.arm; fi
48fi
49
50hostercheck=`echo $INPUT | tr 'A-Z' 'a-z' | sed 's!://!\n!' | cut -d'/' -f1 | tail -n1 | tr '.' '\n' | wc -l`
51hosterline=`expr $hostercheck - 1`
52hoster=`echo $INPUT | tr 'A-Z' 'a-z' | sed 's!://!\n!' | cut -d'/' -f1 | tail -n1 | cut -d"." -f$hosterline`
53#echo $hoster
54
55debuglevel=`cat /mnt/config/titan.cfg | grep debuglevel | cut -d"=" -f2`
56curlbin='curl -k -s -L --cookie /mnt/network/cookies --cookie-jar /mnt/network/cookies'
57if [ "$debuglevel" == "99" ]; then curlbin="$curlbin -v"; fi
58
59ecostream()
60{
61        hosterurl=http://www.ecostream.tv
62        data="tpm=`$curlbin $INPUT | grep footerhash | cut -d"'" -f2``$curlbin $INPUT | grep superslots | cut -d"'" -f2`&id=`$curlbin $INPUT | grep data-id | cut -d'"' -f4`"
63        streampage=`$curlbin $hosterurl/js/ecoss.js | grep "$.post('" | grep videos | cut -d"'" -f2`
64        streamurl=$hosterurl`$curlbin -H "X-Requested-With: XMLHttpRequest" -X POST --data "$data" --referer $INPUT $hosterurl/$streampage | cut -d'"' -f6`
65        if [ "`echo $streamurl | grep DOCTYPE | wc -l`" -eq 0 ] && [ "$streamurl" != "$hosterurl" ];then
66                echo $streamurl
67        fi
68}
69
70giga()
71{
72        streampage=`$curlbin $INPUT | grep "<iframe src=" | cut -d'"' -f2 | head -n1`
73        streamurl=`$curlbin $streampage | grep '{file:' | cut -d'"' -f2 | grep 1080p`
74        if [ -z "$streamurl" ];then
75                streamurl=`$curlbin $streampage | grep '{file:' | cut -d'"' -f2 | grep 720p`
76        fi
77        if [ -z "$streamurl" ];then
78                streamurl=`$curlbin $streampage | grep '{file:' | cut -d'"' -f2 | grep 480p`
79        fi
80        if [ -z "$streamurl" ];then
81                streamurl=`$curlbin $streampage | grep '{file:' | cut -d'"' -f2 | grep 360p`
82        fi
83        if [ -z "$streamurl" ];then
84                streamurl=`$curlbin $streampage | grep '{file:' | cut -d'"' -f2 | grep 240p`
85        fi
86        if [ -z "$streamurl" ];then
87                streamurl=`$curlbin $streampage | grep '{file:' | cut -d'"' -f2 | grep 180p`
88        fi
89        echo $streamurl
90}
91
92vidup()
93{
94        $BIN $CMD/vidup.py $INPUT
95}
96
97nosvideo()
98{
99        $BIN $CMD/nosvideo.py $INPUT
100}
101
102allmyvideos()
103{
104        $BIN $CMD/allmyvideos.py $INPUT
105}
106
107flashx()
108{
109        $BIN $CMD/flashx.py $INPUT
110}
111
112openload()
113{
114        $BIN $CMD/openload.py $INPUT
115}
116
117briskfile()
118{
119        $BIN $CMD/briskfile.py $INPUT
120}
121
122vodlocker()
123{
124        $BIN $CMD/vodlocker.py $INPUT
125}
126
127videoweed()
128{
129        $BIN $CMD/videoweed.py $INPUT
130}
131
132vodzi()
133{
134        $BIN $CMD/vodzi.py $INPUT
135}
136
137youwatch()
138{
139        $BIN $CMD/youwatch.py $INPUT
140}
141
142thevideo()
143{
144        $BIN $CMD/thevideo.py $INPUT
145}
146
147movshare()
148{
149        $BIN $CMD/movshare.py $INPUT
150}
151
152streamcloud()
153{
154        $BIN $CMD/streamcloud.py $INPUT
155}
156
157vidzi()
158{
159        $BIN $CMD/vidzi.py $INPUT
160}
161
162vivo()
163{
164        $BIN $CMD/vivo.py $INPUT
165}
166
167vidto()
168{
169        $BIN $CMD/vidto.py $INPUT
170}
171
172goldesel()
173{
174        $BIN $CMD/goldesel.py $INPUT
175}
176
177cloudflare()
178{
179        $BIN $CMD/cloudflare.py $INPUT
180}
181
182nowvideo()
183{
184        $BIN $CMD/nowvideo.py $INPUT
185}
186
187divxstage()
188{
189        $BIN $CMD/divxstage.py $INPUT
190}
191
192novamov()
193{
194        $BIN $CMD/novamov.py $INPUT
195}
196
197xvidstage()
198{
199        $BIN $CMD/xvidstage.py $INPUT
200}
201
202directstream()
203{
204        echo "$INPUT"
205#       rm -f /tmp/_last_hoster_* > /dev/null 2>&1
206        echo  "$INPUT" > /tmp/.last_hoster_$hoster.log
207}
208
209youtube_dl()
210{
211#       rm -f /tmp/_last_hoster_* > /dev/null 2>&1
212        echo "$BIN $youtubebin $INPUT" > /tmp/.last_hoster_youtube_dl.log
213#       $BIN $youtubebin "$INPUT"
214#       $BIN $CMD/lib/youtube_dl/__main__.py --no-check-certificate --cookies /mnt/network/cookies --user-agent "$USERAGENT" --all-formats -g "$INPUT"
215        URL=`$BIN $CMD/lib/youtube_dl/__main__.py --no-check-certificate --cookies /mnt/network/cookies --user-agent "$USERAGENT" --format mp4 --restrict-filenames --ignore-errors -g "$INPUT"`
216        echo "$URL" >> /tmp/.last_hoster_youtube_dl.log
217        echo $URL
218}
219
220if [ "$TYPE" == "get" ];then
221        echo  "$INPUT" > /tmp/.last_hoster_$hoster.log
222        case $hoster in
223                ecostream) ecostream $INPUT;;
224                giga) giga $INPUT;;
225                nosvideo) nosvideo $INPUT;;
226                allmyvideos) allmyvideos $INPUT;;
227                flashx) flashx $INPUT;;
228                openload_aus) openload $INPUT;;
229                briskfile) briskfile $INPUT;;
230                videoweed|bitvid) videoweed $INPUT;;
231                vodlocker) vodlocker $INPUT;;
232                youwatch|chouhaa|ay8ou8ohth) youwatch $INPUT;;
233                thevideo) thevideo $INPUT;;
234                movshare|wholecloud|vidgg) movshare $INPUT;;
235                vidto) vidto $INPUT;;
236                vidup) vidup $INPUT;;
237                vidzi) vidzi $INPUT;;
238                vivo) vivo $INPUT;;
239                goldesel|movie4k) cloudflare $INPUT;;
240                streamcloud1) streamcloud $INPUT;;     
241                nowvideo) nowvideo $INPUT;;
242                divxstage|cloudtime) divxstage $INPUT;;
243                novamov|auroravid) novamov $INPUT;;
244                xvidstage) xvidstage $INPUT;;
245                redirector|googlevideo|vodcloud|google) directstream "$INPUT";;
246        esac
247fi
248
249if [ "$TYPE" == "youtube_dl" ];then
250        case $hoster in
251                *) youtube_dl $INPUT;;
252        esac
253fi
Note: See TracBrowser for help on using the repository browser.