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

Last change on this file since 41275 was 41275, checked in by obi, 6 years ago

fix

  • Property svn:executable set to *
File size: 12.8 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
14#USERAGENT='Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0'
15USERAGENT='Mozilla%2F5.0+%28Windows+NT+6.3%3B+rv%3A36.0%29+Gecko%2F20100101+Firefox%2F36.0'
16debuglevel=`cat /mnt/config/titan.cfg | grep debuglevel | cut -d"=" -f2`
17curlbin="curl -k -s -L --cookie /mnt/network/cookies --cookie-jar /mnt/network/cookies -A $USERAGENT"
18curlbin2="curl -k -s --cookie /mnt/network/cookies --cookie-jar /mnt/network/cookies -A $USERAGENT"
19youtubebin="$CMD/lib/youtube_dl/__main__.py --no-check-certificate --cookies /mnt/network/cookies --user-agent $USERAGENT --format mp4 --restrict-filenames --ignore-errors -g"
20youtubebinbg="$CMD/lib/youtube_dl/__main__.py --no-check-certificate --cookies /mnt/network/cookies --user-agent $USERAGENT --format mp4 --restrict-filenames --ignore-errors --output"
21export PYTHONHOME=/tmp/localhoster
22export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/localhoster/lib
23
24
25if [ "$debuglevel" == "99" ]; then curlbin="$curlbin -v"; fi
26if [ "$debuglevel" == "99" ]; then curlbin2="$curlbin2 -v"; fi
27if [ "$debuglevel" == "99" ]; then youtubebin="$youtubebin --verbose"; fi
28
29wgetbin="wget -q -T2"
30
31BIN="$CMD"/bin/python."$ARCH"
32
33if [ ! -e "/tmp/localhoster/lib/python2.7/lib-dynload" ] && [ -e /tmp/localhoster/lib/python2.7/lib-dynload."$ARCH" ];then
34#       ln -fs /tmp/localhoster/lib/python2.7/lib-dynload."$ARCH" /tmp/localhoster/lib/python2.7/lib-dynload
35        mv -f /tmp/localhoster/lib/python2.7/lib-dynload."$ARCH" /tmp/localhoster/lib/python2.7/lib-dynload
36        rm -rf /tmp/localhoster/lib/python2.7/lib-dynload.*
37fi
38if [ ! -e "/tmp/localhoster/lib/libpython2.7.so.1.0" ] && [ -e /tmp/localhoster/lib/libpython2.7.so.1.0."$ARCH" ];then
39#       ln -fs /tmp/localhoster/lib/libpython2.7.so.1.0."$ARCH" /tmp/localhoster/lib/libpython2.7.so.1.0
40        mv -f /tmp/localhoster/lib/libpython2.7.so.1.0."$ARCH" /tmp/localhoster/lib/libpython2.7.so.1.0
41        rm -f /tmp/localhoster/lib/libpython2.7.so.1.0.*
42fi
43if [ ! -e "/tmp/localhoster/lib/libcrypto.so.1.0.0" ] && [ -e /tmp/localhoster/lib/libcrypto.so.1.0.0."$ARCH" ];then
44#       ln -fs /tmp/localhoster/lib/libcrypto.so.1.0.0."$ARCH" /tmp/localhoster/lib/libcrypto.so.1.0.0
45        mv -f /tmp/localhoster/lib/libcrypto.so.1.0.0."$ARCH" /tmp/localhoster/lib/libcrypto.so.1.0.0
46        rm -f /tmp/localhoster/lib/libcrypto.so.1.0.0.*
47fi
48if [ ! -e "/tmp/localhoster/lib/libssl.so.1.0.0" ] && [ -e /tmp/localhoster/lib/libssl.so.1.0.0."$ARCH" ];then
49#       ln -fs /tmp/localhoster/lib/libssl.so.1.0.0."$ARCH" /tmp/localhoster/lib/llibssl.so.1.0.0
50        mv -f /tmp/localhoster/lib/libssl.so.1.0.0."$ARCH" /tmp/localhoster/lib/libssl.so.1.0.0
51        rm -f /tmp/localhoster/lib/libssl.so.1.0.0.*
52fi
53
54if [ -e "$TMP/hoster.tar" ]; then rm -f $TMP/hoster.tar; fi
55if [ -e "$TMP/parser.tar" ]; then rm -f $TMP/parser.tar; fi
56
57if [ "$ARCH" == "sh4" ] && [ "$BOX" != "ufs912" ]; then
58        if [ -e "$CMD/lib/python2.7/lib-dynload.mipsel" ]; then rm -rf $CMD/lib/python2.7/lib-dynload.mipsel; fi
59        if [ -e "$CMD/lib/python2.7/lib-dynload.arm" ]; then rm -rf $CMD/lib/python2.7/lib-dynload.arm; fi
60
61        if [ -e "$CMD/lib/libpython2.7.so.1.0.mipsel" ]; then rm -rf $CMD/lib/libpython2.7.so.1.0.mipsel; fi
62        if [ -e "$CMD/lib/libpython2.7.so.1.0.arm" ]; then rm -rf $CMD/lib/libpython2.7.so.1.0.arm; fi
63
64        if [ -e "$CMD/lib/libssl.so.1.0.0.mipsel" ]; then rm -rf $CMD/lib/libssl.so.1.0.0.mipsel; fi
65        if [ -e "$CMD/lib/libssl.so.1.0.0.arm" ]; then rm -rf $CMD/lib/libssl.so.1.0.0.arm; fi
66
67        if [ -e "$CMD/lib/libcrypto.so.1.0.0.mipsel" ]; then rm -rf $CMD/lib/libcrypto.so.1.0.0.mipsel; fi
68        if [ -e "$CMD/lib/libcrypto.so.1.0.0.arm" ]; then rm -rf $CMD/lib/libcrypto.so.1.0.0.arm; fi
69fi
70
71hostercheck=`echo $INPUT | tr 'A-Z' 'a-z' | sed 's!://!\n!' | cut -d'/' -f1 | tail -n1 | tr '.' '\n' | wc -l`
72hosterline=`expr $hostercheck - 1`
73hoster=`echo $INPUT | tr 'A-Z' 'a-z' | sed 's!://!\n!' | cut -d'/' -f1 | tail -n1 | cut -d"." -f$hosterline`
74#echo $hoster
75
76ecostream()
77{
78        hosterurl=http://www.ecostream.tv
79        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`"
80        streampage=`$curlbin $hosterurl/js/ecoss.js | grep "$.post('" | grep videos | cut -d"'" -f2`
81        streamurl=$hosterurl`$curlbin -H "X-Requested-With: XMLHttpRequest" -X POST --data "$data" --referer $INPUT $hosterurl/$streampage | cut -d'"' -f6`
82        if [ "`echo $streamurl | grep DOCTYPE | wc -l`" -eq 0 ] && [ "$streamurl" != "$hosterurl" ];then
83                echo $streamurl
84        fi
85}
86
87giga()
88{
89        streampage=`$curlbin $INPUT | grep "<iframe src=" | cut -d'"' -f2 | head -n1`
90        streamurl=`$curlbin $streampage | grep '{file:' | cut -d'"' -f2 | grep 1080p`
91        if [ -z "$streamurl" ];then
92                streamurl=`$curlbin $streampage | grep '{file:' | cut -d'"' -f2 | grep 720p`
93        fi
94        if [ -z "$streamurl" ];then
95                streamurl=`$curlbin $streampage | grep '{file:' | cut -d'"' -f2 | grep 480p`
96        fi
97        if [ -z "$streamurl" ];then
98                streamurl=`$curlbin $streampage | grep '{file:' | cut -d'"' -f2 | grep 360p`
99        fi
100        if [ -z "$streamurl" ];then
101                streamurl=`$curlbin $streampage | grep '{file:' | cut -d'"' -f2 | grep 240p`
102        fi
103        if [ -z "$streamurl" ];then
104                streamurl=`$curlbin $streampage | grep '{file:' | cut -d'"' -f2 | grep 180p`
105        fi
106        echo $streamurl
107}
108
109vidup()
110{
111        $BIN $CMD/vidup.py $INPUT
112}
113
114nosvideo()
115{
116        $BIN $CMD/nosvideo.py $INPUT
117}
118
119allmyvideos()
120{
121        $BIN $CMD/allmyvideos.py $INPUT
122}
123
124flashx()
125{
126        $BIN $CMD/flashx.py $INPUT
127}
128
129openload()
130{
131        $BIN $CMD/openload.py $INPUT
132}
133
134briskfile()
135{
136        $BIN $CMD/briskfile.py $INPUT
137}
138
139vodlocker()
140{
141        $BIN $CMD/vodlocker.py $INPUT
142}
143
144videoweed()
145{
146        $BIN $CMD/videoweed.py $INPUT
147}
148
149vodzi()
150{
151        $BIN $CMD/vodzi.py $INPUT
152}
153
154youwatch()
155{
156        $BIN $CMD/youwatch.py $INPUT
157}
158
159thevideo()
160{
161        $BIN $CMD/thevideo.py $INPUT
162}
163
164movshare()
165{
166        $BIN $CMD/movshare.py $INPUT
167}
168
169streamcloud()
170{
171        $BIN $CMD/streamcloud.py $INPUT
172}
173
174vidzi()
175{
176        $BIN $CMD/vidzi.py $INPUT
177}
178
179vivo()
180{
181        $BIN $CMD/vivo.py $INPUT
182}
183
184vidto()
185{
186        $BIN $CMD/vidto.py $INPUT
187}
188
189goldesel()
190{
191        $BIN $CMD/goldesel.py $INPUT
192}
193
194cloudflare()
195{
196        $BIN $CMD/cloudflare.py $INPUT
197}
198
199nowvideo()
200{
201        $BIN $CMD/nowvideo.py $INPUT
202}
203
204divxstage()
205{
206        $BIN $CMD/divxstage.py $INPUT
207}
208
209novamov()
210{
211        $BIN $CMD/novamov.py $INPUT
212}
213
214xvidstage()
215{
216        $BIN $CMD/xvidstage.py $INPUT
217}
218
219waaw()
220{
221        $BIN $CMD/waaw.py $INPUT
222}
223
224streamango()
225{
226        $BIN $CMD/streamango.py $INPUT
227}
228
229vidlox()
230{
231        $BIN $CMD/vidlox.py $INPUT
232}
233
234aliezold()
235{
236        URL=`$curlbin "$INPUT" | sed 's/source:/\nsource:/' | grep ^source: | cut -d"'" -f2`
237        REFERER=`echo "$INPUT" | sed -e 's/=/3D/g' -e 's/&/26/g'`
238        echo "$URL|Referer=$REFERER&User-Agent=$USERAGENT"
239}
240
241aliez1()
242{
243        #http://emb.aliez.me/player/live.php?id=56180&w=700&h=480"
244        $curlbin "$INPUT" -o $TMP/cache.$hoster.1
245        cat $TMP/cache.$hoster.1 | sed 's/source:/\nfound=/' | grep ^found= | cut -d"'" -f2 >$TMP/cache.$hoster.url1
246        URL=`cat $TMP/cache.$hoster.url1 | head -n1`
247
248#URL=""
249        #"file":                "rtmp%3A%2F%2Fa3.aliez.me%2Flive%2Fstreama57449%3Ftoken%3Dd11304fabb8e64327df8427e1c2fd5d9"
250        if [ -z "$URL" ];then
251                cat $TMP/cache.$hoster.1 | sed 's/"file":/\nfound=/' | grep ^found= | cut -d'"' -f2 >$TMP/cache.$hoster.url3
252                URL=`cat $TMP/cache.$hoster.url3 | head -n1`
253        fi
254        REFERER=`echo "$INPUT" | sed -e 's/=/%3D/g' -e 's/&/%26/g'`
255        EXTRA="|Referer=$REFERER&User-Agent=$USERAGENT"
256
257        if [ "`echo $URL | grep rtmp | wc -l`" -eq 1 ];then
258
259                #new swfobject.embedSWF("http://i.aliez.me/swf/playernew.swf?0", "mediaspace", "700", "480", "9.0.115.0", false, flashvars, params);
260                cat $TMP/cache.$hoster.1 | sed 's/swfobject.embedSWF/\nfound=/' | grep ^found= | cut -d'"' -f2 >$TMP/cache.$hoster.rtmp.swfurl
261                SWFURL=`cat $TMP/cache.$hoster.rtmp.swfurl | head -n1`
262                URL=`echo "$URL" | sed -e 's/%3A/:/g' -e 's!%2F!/!g' -e 's!%3D!=!g' -e 's!%3F!?!g'`
263                EXTRA=" pageUrl=$REFERER"
264                if [ ! -z "$SWFURL" ];then
265                        EXTRA="$EXTRA swfUrl=$SWFURL swfVfy=1 timeout=15 live=1"
266                fi
267        fi
268
269#       URL=""
270        #file:  'http://a3.aliez.me:8080/hls/streama57449/index.m3u8?st=dgw2dOq8tyFkLLBLn2ycXA',
271        if [ -z "$URL" ];then
272                cat $TMP/cache.$hoster.1 | sed 's/file:/\nfound=/' | grep ^found= | cut -d"'" -f2 >$TMP/cache.$hoster.url2
273                URL=`cat $TMP/cache.$hoster.url2 | head -n1`
274                EXTRA="|Referer=$REFERER&User-Agent=$USERAGENT"
275        fi
276
277        echo "$URL$EXTRA"
278#       echo "$URL|If-None-Match=5a1842ad-c4&Accept=*/*&Referer=$REFERER&User-Agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
279
280
281}
282
283        #http://emb.aliez.me/player/live.php?id=56180&w=700&h=480"
284        REFERER=`echo "$INPUT" | sed -e 's/=/%3D/g' -e 's/&/%26/g'`
285        EXTRA="|Referer=$REFERER&User-Agent=$USERAGENT"
286
287        $curlbin "$INPUT" -o $TMP/cache.$hoster.1
288        cat $TMP/cache.$hoster.1 | sed 's/source:/\nfound=/' | grep ^found= | cut -d"'" -f2 >$TMP/cache.$hoster.url1
289        URL=`cat $TMP/cache.$hoster.url1 | head -n1`
290        URLMP41="$URL$EXTRA"
291
292#       URL=""
293        #file:  'http://a3.aliez.me:8080/hls/streama57449/index.m3u8?st=dgw2dOq8tyFkLLBLn2ycXA',
294
295        cat $TMP/cache.$hoster.1 | sed 's/file:/\nfound=/' | grep ^found= | cut -d"'" -f2 >$TMP/cache.$hoster.url2
296        URL=`cat $TMP/cache.$hoster.url2 | head -n1`
297        URLMP42="$URL$EXTRA"
298
299#URL=""
300        #"file":                "rtmp%3A%2F%2Fa3.aliez.me%2Flive%2Fstreama57449%3Ftoken%3Dd11304fabb8e64327df8427e1c2fd5d9"
301        cat $TMP/cache.$hoster.1 | sed 's/"file":/\nfound=/' | grep ^found= | cut -d'"' -f2 >$TMP/cache.$hoster.url3
302        URL=`cat $TMP/cache.$hoster.url3 | head -n1`
303
304        if [ "`echo $URL | grep rtmp | wc -l`" -eq 1 ];then
305                #new swfobject.embedSWF("http://i.aliez.me/swf/playernew.swf?0", "mediaspace", "700", "480", "9.0.115.0", false, flashvars, params);
306                cat $TMP/cache.$hoster.1 | sed 's/swfobject.embedSWF/\nfound=/' | grep ^found= | cut -d'"' -f2 >$TMP/cache.$hoster.rtmp.swfurl
307                SWFURL=`cat $TMP/cache.$hoster.rtmp.swfurl | head -n1`
308                URL=`echo "$URL" | sed -e 's/%3A/:/g' -e 's!%2F!/!g' -e 's!%3D!=!g' -e 's!%3F!?!g'`
309                EXTRA=" pageUrl=$REFERER"
310                if [ ! -z "$SWFURL" ];then
311                        EXTRA="$EXTRA swfUrl=$SWFURL swfVfy=1 timeout=15 live=1"
312                fi
313                URLRTMP="$URL$EXTRA"
314        fi
315
316        STREAMLIST="$TMP/$PARSER.$INPUT.$FROM.$FILENAME.streamlist"
317        if [ -e "$STREAMLIST" ];then
318                rm -f $STREAMLIST
319        fi
320        for ROUND in $URLMP42 $URLMP41 $URLRTMP; do
321                echo "$ROUND" >> $STREAMLIST
322        done
323        URL=$STREAMLIST
324
325
326        echo "$URL"
327
328sport7()
329{
330        #http://sport7.tech/487b826914d11080dce4b502052b012d-live.html
331        #var videoLink = 'http://g4.securestream.sport7.tech/stream/NzYyZDUwZWNkODc5YWM5YjViY2ZkOTVhZGNjOGM1ZTc=/BTSport3.m3u8';
332           
333        URL=`$curlbin "$INPUT" | sed 's/var videoLink/\nfound=/' | grep ^found= | cut -d"'" -f2`
334        REFERER=`echo "$INPUT" | sed -e 's/=/3D/g' -e 's/&/26/g'`
335        sed 's/#HttpOnly_//g' -i /mnt/network/cookies
336        echo "$URL|Referer=$REFERER&X-f=95.91.79.87&User-Agent=$USERAGENT"
337}
338
339
340directstream()
341{
342        echo "$INPUT"
343#       rm -f /tmp/_last_hoster_* > /dev/null 2>&1
344        echo  "$INPUT" > /tmp/.last_hoster_$hoster.log
345}
346
347youtube_dl()
348{
349#       echo "$BIN $youtubebin $INPUT" > /tmp/.last_hoster_youtube_dl.log
350#       $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
351#       cat /tmp/youtube_dl.streamlink.log | tail -n1
352        $BIN $youtubebin "$INPUT"
353}
354
355youtube_dlbg()
356{
357#       echo "$BIN $youtubebinbg $DEST $INPUT" > /tmp/.last_hoster_youtube_dlbg.log
358#       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"`
359#       echo "$URL" >> /tmp/.last_hoster_youtube_dlbg.log
360#       echo $URL
361        $BIN $youtubebinbg $DEST $INPUT
362}
363
364if [ "$TYPE" == "get" ];then
365        echo  "$INPUT" > /tmp/.last_hoster_$TYPE_$hoster.log
366        case $hoster in
367                ecostream) ecostream $INPUT;;
368                giga) giga $INPUT;;
369                nosvideo) nosvideo $INPUT;;
370                allmyvideos) allmyvideos $INPUT;;
371                flashx) flashx $INPUT;;
372                openload|oload) openload $INPUT;;
373                briskfile) briskfile $INPUT;;
374                videoweed|bitvid) videoweed $INPUT;;
375                vodlocker) vodlocker $INPUT;;
376                youwatch|chouhaa|ay8ou8ohth) youwatch $INPUT;;
377                thevideo) thevideo $INPUT;;
378                movshare|wholecloud|vidgg) movshare $INPUT;;
379                vidto) vidto $INPUT;;
380                vidup) vidup $INPUT;;
381                vidzi) vidzi $INPUT;;
382                vivo) vivo $INPUT;;
383                goldesel|movie4k) cloudflare $INPUT;;
384                streamcloud1) streamcloud $INPUT;;     
385                nowvideo) nowvideo $INPUT;;
386                divxstage|cloudtime) divxstage $INPUT;;
387                novamov|auroravid) novamov $INPUT;;
388                xvidstage) xvidstage $INPUT;;
389                waaw|netu|hqq) waaw $INPUT;;
390                streamango|streamcherry) streamango $INPUT;;
391                vidlox) vidlox $INPUT;;
392                redirector|googlevideo|vodcloud|google) directstream "$INPUT";;
393                aliez) aliez $INPUT;;
394                sport7) sport7 $INPUT;;
395        esac
396fi
397
398if [ "$TYPE" == "youtube_dl" ];then
399        echo  "$INPUT" > /tmp/.last_hoster_$TYPE_$hoster.log
400        case $hoster in
401                *) youtube_dl $INPUT;;
402        esac
403fi
404
405if [ "$TYPE" == "youtube_dlbg" ];then
406        echo  "$INPUT" > /tmp/.last_hoster_$TYPE_$hoster.log
407        case $hoster in
408                *) youtube_dlbg $DEST $INPUT;;
409        esac
410fi
411
Note: See TracBrowser for help on using the repository browser.