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

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

next

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