Changeset 42919 for titan/mediathek


Ignore:
Timestamp:
Oct 17, 2018, 10:50:07 PM (17 months ago)
Author:
obi
Message:

tithek foy thevideo

Location:
titan/mediathek/localhoster
Files:
2 edited

Legend:

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

    r42650 r42919  
    191191thevideo()
    192192{
    193         $BIN $CMD/thevideo.py $INPUT
     193        $BIN $CMD/thevideo.py $INPUT > $TMP/cache.$FILENAME.1
     194
     195        videocode=`cat $TMP/cache.$FILENAME.1`
     196
     197        rm -f $TMP/cache.hoster.$hoster.* > /dev/null 2>&1
     198
     199        STREAMLIST="$TMP/$TYPE.$hoster.$FILENAME.streamlist"
     200        if [ -e "$STREAMLIST" ];then
     201                rm -f $STREAMLIST > /dev/null 2>&1
     202        fi
     203
     204        $curlbin --data '{}' https://vev.io/api/serve/video/$videocode -o $TMP/cache.$FILENAME.2
     205        cat $TMP/cache.$FILENAME.2 | sed 's/{/\n/g' | sed 's/,/\n/g' | grep "/stream/" >$TMP/cache.$FILENAME.3
     206
     207        while read -u 3 ROUND; do
     208                TITEL=`echo $ROUND | cut -d'"' -f2`
     209                URL=`echo $ROUND | cut -d'"' -f4`
     210
     211                if [ ! -z "$URL" ];then
     212                        echo "$URL" | tr -d '\n' | tr -d '\r' >> $STREAMLIST
     213                        echo "" >> $STREAMLIST
     214                fi
     215
     216
     217        done 3<$TMP/cache.$FILENAME.3
     218        rm $TMP/cache.$FILENAME.* > /dev/null 2>&1
     219        echo $STREAMLIST
    194220}
    195221
     
    769795                vodlocker) vodlocker $INPUT;;
    770796                youwatch|chouhaa|ay8ou8ohth) youwatch $INPUT;;
    771                 thevideo) thevideo $INPUT;;
     797                thevideo|tvad|vev) thevideo $INPUT;;
    772798                movshare|wholecloud|vidgg) movshare $INPUT;;
    773799                vidto) vidto $INPUT;;
     
    804830fi
    805831
    806 if [ "$TYPE" == "youtube_dl" ];then
     832if [ "$TYPE" == "youtube_dl" ];thenthevideo.cc
    807833        echo  "$INPUT" > /tmp/.last_hoster_$TYPE_$hoster.log
    808834        case $hoster in
  • titan/mediathek/localhoster/thevideo.py

    r41171 r42919  
    99import lib.common as common
    1010from lib import jsunpack
     11import re, urllib, json
    1112
    1213INTERVALS = 5
     
    1516    name = "thevideo"
    1617    domains = ["thevideo.me"]
    17     pattern = '(?://|\.)(thevideo\.me)/(?:embed-|download/)?([0-9a-zA-Z]+)'
     18    pattern = '(?://|\.)(thevideo\.me|thevideo\.cc|vev\.io|tvad./me)/(?:embed-|download/)?([0-9a-zA-Z]+)'
    1819
    1920    def __init__(self):
    20         self.net = Net()
     21#        self.net = Net()
     22        self.net = Net(cookie_file='/mnt/network/cookies', http_debug = False)
    2123        self.headers = {'User-Agent': common.ANDROID_USER_AGENT}
    2224        url = str(sys.argv[1])
     
    3537    def get_media_url(self, host, media_id):
    3638        web_url = self.get_url(host, media_id)
     39
    3740        headers = {
    3841            'Referer': web_url
    3942        }
    4043        headers.update(self.headers)
    41         html = self.net.http_GET(web_url, headers=headers).content
    4244
    43         r = re.search('sources:\s*(\[.*?\])', html, re.DOTALL)
     45        response = self.net.http_GET(web_url, headers=headers).content
     46        ret = self.net.save_cookies('/mnt/network/cookies')
     47        videoCode = self.getSearchGroups(response, r'''['"]video_code['"]\s*:\s*['"]([^'^"]+?)['"]''')[0]
     48        print videoCode
    4449
    45         if r:
    46             sources = json.loads(r.group(1))
    47             max_label = 0
    48             stream_url = ''
    49             for source in sources:
    50                 if 'label' in source and int(re.sub('[^0-9]', '', source['label'])) > max_label:
    51                     stream_url = source['file']
    52                     max_label = int(re.sub('[^0-9]', '', source['label']))
     50    def getSearchGroups(self, data, pattern, grupsNum=1, ignoreCase=False):
     51        tab = []
     52        if ignoreCase:
     53            match = re.search(pattern, data, re.IGNORECASE)
     54        else:
     55            match = re.search(pattern, data)
     56       
     57        for idx in range(grupsNum):
     58            try:    value = match.group(idx + 1)
     59            except Exception: value = ''
     60            tab.append(value)
     61        return tab
    5362
    54         if re.search('File was deleted.', html):
    55             print 'errormsg=File was deleted.'
    56 
    57         varname = re.search('''concat\(\s*['"]/["']\s*\+([^\+]+?)\+''', html).group(1)
    58 
    59 #        authkey = re.search('''var lets_play_a_game=\'(.*)\'''', html).group(1)
    60 #        print "authkey2", authkey
    61 
    62         authkey = re.search(r"=\'(.*)\'", html).group(1)
    63 
    64 #        my_regex = r"var " + re.escape(varname) + r"""\s*=\s*['"]([^'^"]+?)['"]"""
    65 #        my_regex = re.escape(varname) + r"""\s*=\s*['"]([^'^"]+?)['"]"""
    66 #
    67 #        test = re.search(my_regex, html, re.IGNORECASE)
    68 #        print "test", test
    69 
    70         web_url = "https://thevideo.me/vsign/player/" + authkey
    71         html = self.net.http_GET(web_url, headers=headers).content
    72 
    73         js_data = jsunpack.unpack(html)
    74         for match in re.finditer('(eval\(function.*?)\{\}\)\)', html, re.DOTALL):
    75             js_data = jsunpack.unpack(match.group(1))
    76             ua = re.search('"ua=(.*?)"', js_data).group(1)
    77             vt = re.search('"vt=(.*?)"', js_data).group(1)
    78             print '%s?direct=false&ua=%s&vt=%s' % (stream_url, ua, vt)
    79 
     63    def getPage(self, url, addParams = {}, post_data = None):
     64        ''' wraps getURLRequestData '''
     65        try:
     66            addParams['url'] = url
     67            if 'return_data' not in addParams:
     68                addParams['return_data'] = True
     69            response = self.getURLRequestData(addParams, post_data)
     70            status = True
     71        except urllib2.HTTPError, e:
     72#            printExc()
     73            response = e
     74            status = False
     75        except Exception:
     76#            printExc()
     77            response = None
     78            status = False
    8079       
     80        if addParams['return_data'] and status and not isinstance(response, basestring):
     81            status = False
     82           
     83        return (status, response)
     84 
    8185    def get_url(self, host, media_id):
    8286        return 'http://%s/embed-%s-640x360.html' % (host, media_id)
Note: See TracChangeset for help on using the changeset viewer.