Changeset 41291 for titan/mediathek


Ignore:
Timestamp:
Nov 25, 2017, 10:29:13 PM (2 years ago)
Author:
obi
Message:

update tithek add hlsdl support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • titan/mediathek/localhoster/hoster.sh

    r41279 r41291  
    99
    1010#FILENAME="`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'` $INPUT $PAGE $NEXT"
    11 FILENAME="`echo $INPUT | sed -e 's/\&\+/./g' -e 's#\/\+#.#g' -e 's/\?\+/./g' -e 's/;\+/./g' -e 's/=\+/./g' -e 's/ \+/./g' -e 's/\.\+/./g'`"
     11FILENAME="`echo $INPUT | sed -e 's/\&\+/./g' -e 's#\/\+#.#g' -e 's/\?\+/./g' -e 's/:\+/./g' -e 's/;\+/./g' -e 's/=\+/./g' -e 's/ \+/./g' -e 's/\.\+/./g'`"
    1212PICNAME=`echo $FILENAME`
    1313
     
    1515        FILENAME=none
    1616fi
     17
    1718
    1819ARCH=`cat /etc/.arch`
     
    2021TMP=/tmp/localcache
    2122CMD=/tmp/localhoster
     23BIN="$CMD"/bin/python."$ARCH"
     24HLSBIN="$CMD"/bin/hlsdl."$ARCH"
    2225#USERAGENT='Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0'
    2326USERAGENT='Mozilla%2F5.0+%28Windows+NT+6.3%3B+rv%3A36.0%29+Gecko%2F20100101+Firefox%2F36.0'
     
    2730youtubebin="$CMD/lib/youtube_dl/__main__.py --no-check-certificate --cookies /mnt/network/cookies --user-agent $USERAGENT --format mp4 --restrict-filenames --ignore-errors -g"
    2831youtubebinbg="$CMD/lib/youtube_dl/__main__.py --no-check-certificate --cookies /mnt/network/cookies --user-agent $USERAGENT --format mp4 --restrict-filenames --ignore-errors --output"
     32hlsdlbg="$HLSBIN -u $USERAGENT -o"
     33
    2934export PYTHONHOME=/tmp/localhoster
    3035export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/localhoster/lib
     
    3641
    3742wgetbin="wget -q -T2"
    38 
    39 BIN="$CMD"/bin/python."$ARCH"
    4043
    4144if [ ! -e "/tmp/localhoster/lib/python2.7/lib-dynload" ] && [ -e /tmp/localhoster/lib/python2.7/lib-dynload."$ARCH" ];then
     
    321324#       $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
    322325#       cat /tmp/youtube_dl.streamlink.log | tail -n1
    323         $BIN $youtubebin "$INPUT"
     326        mkdir $TMP > /dev/null 2>&1
     327
     328        echo "$BIN $youtubebin $INPUT" > /tmp/.last_hoster_youtube_dl.log
     329
     330        $BIN $youtubebin "$INPUT" > $TMP/$TYPE.$hoster.$FILENAME.streamlist
     331        echo $TMP/$TYPE.$hoster.$FILENAME.streamlist
    324332}
    325333
     
    330338#       echo "$URL" >> /tmp/.last_hoster_youtube_dlbg.log
    331339#       echo $URL
    332         $BIN $youtubebinbg $DEST $INPUT
    333 }
     340        mkdir $TMP > /dev/null 2>&1
     341
     342        echo "$BIN $youtubebinbg $DEST $INPUT" > /tmp/.last_hoster_$TYPE.log
     343        $BIN $youtubebinbg "$DEST" "$INPUT" >> /tmp/.last_hoster_$TYPE.log
     344#       echo $TMP/$TYPE.$hoster.$FILENAME.streamlist
     345}
     346
     347hlsdl()
     348{
     349        mkdir $TMP > /dev/null 2>&1
     350
     351        echo "$HLSBIN $hlsdlbg $DEST $INPUT" > /tmp/.last_hoster_$TYPE.log
     352
     353        REFERER=$(echo "$INPUT" | sed -nr 's/.*Referer=([^=]+)&.*/\1/p')
     354        if [ -z "$REFERER" ];then
     355                REFERER=$(echo "$INPUT" | sed -nr 's/.*Referer=([^=]+).*/\1/p')
     356        fi
     357
     358        if [ ! -z "$REFERER" ];then
     359                REFERER="Referer: $REFERER"
     360        fi
     361
     362        TMPUSERAGENT=$(echo "$INPUT" | sed -nr 's/.*User-Agent=([^=]+)&.*/\1/p')
     363        if [ -z "$TMPUSERAGENT" ];then
     364                TMPUSERAGENT=$(echo "$INPUT" | sed -nr 's/.*User-Agent=([^=]+).*/\1/p')
     365        fi
     366        if [ ! -z "$TMPUSERAGENT" ];then
     367                USERAGENT=$TMPUSERAGENT
     368        fi
     369
     370        URL=$(echo "$INPUT" | tr '|' '\n' | head -n1)
     371
     372        echo $HLSBIN "$URL" -v -f -u "$USERAGENT" -h "$REFERER" -o "$DEST" >> /tmp/.last_hoster_$TYPE.log
     373        $HLSBIN "$URL" -v -f -u "$USERAGENT" -h "$REFERER" -o "$DEST" >> /tmp/.last_hoster_$TYPE.log
     374#       $HLSBIN "$URL" -v -u "$USERA" -h "$REFERER" -o "$DEST" >> /tmp/.last_hoster_$TYPE.log
     375
     376}
     377
    334378
    335379if [ "$TYPE" == "get" ];then
     
    381425fi
    382426
     427if [ "$TYPE" == "hlsdl" ];then
     428        echo  "$INPUT" > /tmp/.last_hoster_$TYPE_$hoster.log
     429        case $hoster in
     430                *) hlsdl $INPUT;;
     431        esac
     432fi
Note: See TracChangeset for help on using the changeset viewer.