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

Last change on this file since 40852 was 40852, checked in by obi, 3 years ago

fix

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