source: titan/mediathek/localparser_secret/streamlive.sh @ 37133

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

fix streamlive

  • Property svn:executable set to *
File size: 4.3 KB
Line 
1#!/bin/sh
2# first sh box parser for titannit mfg obi
3
4SRC=$1
5INPUT=$2
6FROM=$3
7PAGE=$4
8FILENAME=`echo $PAGE | tr '/' '.'`
9if [ -z "$PAGE" ]; then
10        FILENAME=none
11fi
12
13ARCH=`cat /etc/.arch`
14URL=http://cricfree.sx/
15PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'`
16NAME=StreamLive
17
18curlbin='curl -k -s -v -L --cookie /mnt/network/cookies --cookie-jar /mnt/network/cookies'
19#useragent="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"
20
21wgetbin="wget -q -T2"
22TMP=/tmp/parser
23#TMP=/mnt/parser/tmp
24#TMP=/var/usr/local/share/titan/plugins/tithek/parser/tmp
25
26#rm -rf $TMP > /dev/null 2>&1
27mkdir $TMP > /dev/null 2>&1
28
29if [ `echo $SRC | grep ^"/mnt/parser" | wc -l` -gt 0 ];then
30        TYPE="$SRC - Shell script"
31elif [ `echo $SRC | grep ^"/var/swap" | wc -l` -gt 0 ];then
32        TYPE="Swap - Shell script"
33elif [ `echo $SRC | grep ^"/mnt/swapextensions" | wc -l` -gt 0 ];then
34        TYPE="Mnt - Shell script"
35else
36        TYPE="Flash - Shell script"
37fi
38
39init()
40{
41        if [ "$ARCH" = "mipsel" ];then
42                rm -f /mnt/network/cookies > /dev/null 2>&1
43                rm -rf $TMP > /dev/null 2>&1
44                echo "$NAME ($TYPE)#$SRC $SRC mainmenu#http://atemio.dyndns.tv/mediathek/menu/$PARSER.jpg#$PARSER.jpg#TiThek#0"
45        fi
46}
47
48mainmenu()
49{
50        echo "Category#$SRC $SRC category#http://atemio.dyndns.tv/mediathek/menu/categoty.jpg#categoty.jpg#$NAME#0" > $TMP/$PARSER.$INPUT.list
51        echo "$TMP/$PARSER.$INPUT.list"
52}
53
54category()
55{
56        echo "Channels#$SRC $SRC list channels /#http://atemio.dyndns.tv/mediathek/menu/categoty.jpg#categoty.jpg#$NAME#0" > $TMP/$PARSER.$INPUT.list
57        echo "$TMP/$PARSER.$INPUT.list"
58}
59
60list()
61{
62        if [ ! -e "$TMP/$PARSER.$INPUT.$FROM.$FILENAME.list" ]; then
63                piccount=0
64
65#               $wgetbin $URL/$PAGE -O $TMP/cache.$PARSER.$FROM.$FILENAME.1
66                $curlbin "http://www.streamlive.to/?p=1&q=&sort=1" -o $TMP/cache.$PARSER.$FROM.$FILENAME.1
67
68#               cat $TMP/cache.$PARSER.$FROM.$FILENAME.1 | tr '\n' '\r' |  tr '\r' ' ' | tr '\n' ' ' | tr '\t' ' ' | sed 's/ \+/ /g' | sed 's!<li class="has-sub">!\n<li class="has-sub">!g' | grep ^'<li class="has-sub">' | sed 's!href=!\n<a href=!g' | grep ^'<a href=' | grep "http://cricfree.sx" | grep -v "/watch/live/" | cut -d '"' -f2 >$TMP/cache.$PARSER.$FROM.$FILENAME.2
69                cat $TMP/cache.$PARSER.$FROM.$FILENAME.1 | tr '\n' '\r' |  tr '\r' ' ' | tr '\n' ' ' | tr '\t' ' ' | sed 's/ \+/ /g' | sed 's!<a href="http://www.streamlive.to/view/!\nhttp://www.streamlive.to/view/!g' | grep ^"http://www.streamlive.to/view/" | grep -v "<strong>" | grep -v "premium_only" >$TMP/cache.$PARSER.$FROM.$FILENAME.2
70
71                while read -u 3 ROUND; do
72
73                        URL=`echo $ROUND | cut -d'"' -f1`
74                        PIC=`echo $ROUND | sed 's!src="!\npic="!g' | grep ^pic= | cut -d'"' -f2 | tail -n1`
75                        TITLE=`echo $ROUND | sed 's!title="!\ntitle="!g' | grep ^title= | cut -d'"' -f2 | tail -n1`
76                        if [ -z "$TITLE" ];then
77                                TITLE=`echo $ROUND | cut -d"<" -f2 | cut -d">" -f2`
78                        fi
79               
80                        if [ -z "$PIC" ] || [ "$PIC" = "http:" ]; then 
81                                PIC="http://atemio.dyndns.tv/mediathek/menu/default.jpg"
82                        fi
83               
84                        TITLE=`echo $URL | tr '/' '\n' | tail -n1 | sed 's/_/ /g'`
85                        TITLE=`echo $TITLE | sed -e 's/&#038;/&/g' -e 's/&amp;/und/g' -e 's/&quot;/"/g' -e 's/&lt;/\</g' -e 's/&#034;/\"/g' -e 's/&#039;/\"/g' -e 's/#034;/\"/g' -e 's/#039;/\"/g' -e 's/&szlig;/Ãx/g' -e 's/&ndash;/-/g' -e 's/&Auml;/Ã/g' -e 's/&Uuml;/ÃS/g' -e 's/&Ouml;/Ã/g' -e 's/&auml;/ä/g' -e 's/&uuml;/ü/g' -e 's/&ouml;/ö/g' -e 's/&eacute;/é/g' -e 's/&egrave;/è/g' -e 's/%F6/ö/g' -e 's/%FC/ü/g' -e 's/%E4/ä/g' -e 's/%26/&/g' -e 's/%C4/Ã/g' -e 's/%D6/Ã/g' -e 's/%DC/ÃS/g' -e 's/%28/(/g' -e 's/%29/)/g' -e 's/%3A/:/g' -e 's/%40/@/g' -e 's/%2B/&/g' -e 's/%C3/A/g' -e 's/%B1/&/g' -e 's/%5B//g' -e 's/%5D//g' -e 's!%2F!/!g' -e 's/|/ /g' -e 's/(/ /g' -e 's/)/ /g' -e 's/+/ /g' -e 's/\//-/g' -e 's/,/ /g' -e 's/;/ /g' -e 's/:/ /g' -e 's/\.\+/./g'`
86
87                        if [ ! -z "$TITLE" ] && [ ! -z "$URL" ];then
88                                if [ ! -e $TMP/$PARSER.$INPUT.$FROM.$FILENAME.list ];then
89                                        touch $TMP/$PARSER.$INPUT.$FROM.$FILENAME.list
90                                fi
91                                piccount=$[$piccount+1]
92                                LINE="$TITLE#$URL#$PIC#$PARSER_$piccount.jpg#$NAME#91"
93                                echo "$LINE" >> $TMP/$PARSER.$INPUT.$FROM.$FILENAME.list
94                        fi
95       
96                done 3<$TMP/cache.$PARSER.$FROM.$FILENAME.2
97                rm $TMP/cache.* > /dev/null 2>&1
98        fi
99        echo "$TMP/$PARSER.$INPUT.$FROM.$FILENAME.list"
100}
101
102case $INPUT in
103        init) $INPUT;;
104        mainmenu) $INPUT;;
105        category) $INPUT;;
106        list) $INPUT;;
107esac
Note: See TracBrowser for help on using the repository browser.