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

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

fix mipsel

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