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

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

fix

  • Property svn:executable set to *
File size: 9.1 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"
20export PYTHONHOME=/tmp/localhoster
21export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/localhoster/lib
22
23if [ "$debuglevel" == "99" ]; then curlbin="$curlbin -v"; fi
24if [ "$debuglevel" == "99" ]; then curlbin2="$curlbin2 -v"; fi
25#if [ "$debuglevel" == "99" ]; then youtubebin="$youtubebin --verbose"; fi
26
27wgetbin="wget -q -T2"
28
29BIN="$CMD"/bin/python."$ARCH"
30
31if [ ! -e "/tmp/localhoster/lib/python2.7/lib-dynload" ] && [ -e /tmp/localhoster/lib/python2.7/lib-dynload."$ARCH" ];then
32#       ln -fs /tmp/localhoster/lib/python2.7/lib-dynload."$ARCH" /tmp/localhoster/lib/python2.7/lib-dynload
33        mv -f /tmp/localhoster/lib/python2.7/lib-dynload."$ARCH" /tmp/localhoster/lib/python2.7/lib-dynload
34        rm -rf /tmp/localhoster/lib/python2.7/lib-dynload.*
35fi
36if [ ! -e "/tmp/localhoster/lib/libpython2.7.so.1.0" ] && [ -e /tmp/localhoster/lib/libpython2.7.so.1.0."$ARCH" ];then
37#       ln -fs /tmp/localhoster/lib/libpython2.7.so.1.0."$ARCH" /tmp/localhoster/lib/libpython2.7.so.1.0
38        mv -f /tmp/localhoster/lib/libpython2.7.so.1.0."$ARCH" /tmp/localhoster/lib/libpython2.7.so.1.0
39        rm -f /tmp/localhoster/lib/libpython2.7.so.1.0.*
40fi
41if [ ! -e "/tmp/localhoster/lib/libcrypto.so.1.0.0" ] && [ -e /tmp/localhoster/lib/libcrypto.so.1.0.0."$ARCH" ];then
42#       ln -fs /tmp/localhoster/lib/libcrypto.so.1.0.0."$ARCH" /tmp/localhoster/lib/libcrypto.so.1.0.0
43        mv -f /tmp/localhoster/lib/libcrypto.so.1.0.0."$ARCH" /tmp/localhoster/lib/libcrypto.so.1.0.0
44        rm -f /tmp/localhoster/lib/libcrypto.so.1.0.0.*
45fi
46if [ ! -e "/tmp/localhoster/lib/libssl.so.1.0.0" ] && [ -e /tmp/localhoster/lib/libssl.so.1.0.0."$ARCH" ];then
47#       ln -fs /tmp/localhoster/lib/libssl.so.1.0.0."$ARCH" /tmp/localhoster/lib/llibssl.so.1.0.0
48        mv -f /tmp/localhoster/lib/libssl.so.1.0.0."$ARCH" /tmp/localhoster/lib/libssl.so.1.0.0
49        rm -f /tmp/localhoster/lib/libssl.so.1.0.0.*
50fi
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        $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"      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" > /tmp/youtube_dl.streamlink.log 2>&1
237        cat /tmp/youtube_dl.streamlink.log
238
239#       echo $URL
240}
241
242youtube_dlbg()
243{
244#       rm -f /tmp/_last_hoster_* > /dev/null 2>&1
245        echo "$BIN $youtubebinbg $DEST $INPUT" > /tmp/.last_hoster_youtube_dlbg.log
246#       $BIN $youtubebin "$INPUT"
247#       $BIN $CMD/lib/youtube_dl/__main__.py --no-check-certificate --cookies /mnt/network/cookies --user-agent "$USERAGENT" --all-formats -g "$INPUT"
248        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"`
249        echo "$URL" >> /tmp/.last_hoster_youtube_dlbg.log
250        echo $URL
251}
252if [ "$TYPE" == "get" ];then
253        echo  "$INPUT" > /tmp/.last_hoster_$hoster.log
254        case $hoster in
255                ecostream) ecostream $INPUT;;
256                giga) giga $INPUT;;
257                nosvideo) nosvideo $INPUT;;
258                allmyvideos) allmyvideos $INPUT;;
259                flashx) flashx $INPUT;;
260                openload_aus) openload $INPUT;;
261                briskfile) briskfile $INPUT;;
262                videoweed|bitvid) videoweed $INPUT;;
263                vodlocker) vodlocker $INPUT;;
264                youwatch|chouhaa|ay8ou8ohth) youwatch $INPUT;;
265                thevideo) thevideo $INPUT;;
266                movshare|wholecloud|vidgg) movshare $INPUT;;
267                vidto) vidto $INPUT;;
268                vidup) vidup $INPUT;;
269                vidzi) vidzi $INPUT;;
270                vivo) vivo $INPUT;;
271                goldesel|movie4k) cloudflare $INPUT;;
272                streamcloud1) streamcloud $INPUT;;     
273                nowvideo) nowvideo $INPUT;;
274                divxstage|cloudtime) divxstage $INPUT;;
275                novamov|auroravid) novamov $INPUT;;
276                xvidstage) xvidstage $INPUT;;
277                redirector|googlevideo|vodcloud|google) directstream "$INPUT";;
278        esac
279fi
280
281if [ "$TYPE" == "youtube_dl" ];then
282        case $hoster in
283                *) youtube_dl $INPUT;;
284        esac
285fi
286
287if [ "$TYPE" == "youtube_dlbg" ];then
288        case $hoster in
289                *) youtube_dlbg $DEST $INPUT;;
290        esac
291fi
292
Note: See TracBrowser for help on using the repository browser.