def resolve(url):
    m = _regex(url)
    if m:
        items = []
        vurl = m.group('url')
        vurl = re.sub('\&[^$]*', '', vurl)
        vurl = re.sub('/embed', '', vurl)
        vurl = 'http://videoapi.my.mail.ru/' + vurl + '.json'

        util.init_urllib()
        req = urllib.request.Request(vurl)
        req.add_header('User-Agent', util.UA)
        resp = urllib.request.urlopen(req)
        data = resp.read()
        vkey = []
        for cookie in re.finditer('(video_key=[^\;]+)',
                                  resp.headers.get('Set-Cookie'),
                                  re.IGNORECASE | re.DOTALL):
            vkey.append(cookie.group(1))
        headers = {'Cookie': vkey[-1]}
        item = util.json.loads(data)
        for v in item[u'videos']:
            quality = v['key']
            link = v['url']
            items.append({'quality': quality, 'url': link, 'headers': headers})
        return items
def resolve(url):
    cookies = {}
    util.init_urllib(cookies)
    data = util.request(url)
    view = pickle.loads(util._cookie_jar.dump())[
        '.mojevideo.sk']['/'].keys()[0]
    st = re.search(r'vHash=\[\'([^\']+)', data)
    if not st:
        return None
    st = st.group(1)
    tim = int(time.time())
    base = 'http://fs5.mojevideo.sk:8080/securevd/'
    return [{'url': base + view.replace('view', '') + '.mp4?st=%s&e=%s|Cookie=%s=1' % (st, tim, view)}]
def resolve(url):
    cookies = {}
    result = []
    util.init_urllib(cookies)
    id = re.search(r'.*player/flash/(?P<url>.+)', url).group('url')
    r = util.request('http://myvi.ru/player/api/Video/Get/%s?sig' % id)
    jsondata = demjson.decode(r)
    playlist = jsondata['sprutoData']['playlist'][0]
    uuid = pickle.loads(
        util._cookie_jar.dump())['.myvi.ru']['/']['UniversalUserID']
    for f in playlist['video']:
        streamurl = f['url']
        streamurl += '|Cookie=UniversalUserID%3D' + urllib.parse.quote(
            uuid.value)
        streamurl += '&User-Agent=' + UA
        result.append({'url': streamurl})
    if result:
        return result
    else:
        return None
Beispiel #4
0
def resolve(url):
    m = _regex(url)
    if not m == None:
        util.init_urllib()
        data = util.request(
            'http://videobb.com/player_control/settings.php?v=%s&em=TRUE&fv=v1.1.67'
            % m.group('id'))
        json = data.replace('false',
                            'False').replace('true',
                                             'True').replace('null', 'None')
        aData = eval('(' + json + ')')
        max_res = 99999
        r = re.finditer('"l".*?:.*?"(.+?)".+?"u".*?:.*?"(.+?)"', json)
        chosen_res = 0
        stream_url = False
        stream_url_part1 = False
        if r:

            for match in r:
                print(match.groups())
                res, url = match.groups()
                res = int(res.strip('p'))
                if res > chosen_res and res <= max_res:
                    stream_url_part1 = url.decode('base-64')
                    chosen_res = res
        else:
            return

        if not stream_url_part1:
            return
        # Decode the link from the json data settings
        spn_ik = unhexlify(
            __decrypt(aData["settings"]["login_status"]["spen"],
                      aData["settings"]["login_status"]["salt"],
                      950569)).split(';')
        spn = spn_ik[0].split('&')
        ik = spn_ik[1]

        for item in ik.split('&'):
            temp = item.split('=')
            if temp[0] == 'ik':
                key = __get_key(temp[1])

        sLink = ""
        for item in spn:
            item = item.split('=')
            if (int(item[1]) == 1):
                sLink = sLink + item[0] + '=' + __decrypt(
                    aData["settings"]["info"]["sece2"],
                    aData["settings"]["config"]["rkts"],
                    key) + '&'  #decrypt32byte
            elif (int(item[1] == 2)):
                sLink = sLink + item[0] + '=' + __decrypt(
                    aData["settings"]["banner"]["g_ads"]["url"],
                    aData["settings"]["config"]["rkts"], key) + '&'
            elif (int(item[1]) == 3):
                sLink = sLink + item[0] + '=' + __decrypt(
                    aData["settings"]["banner"]["g_ads"]["type"],
                    aData["settings"]["config"]["rkts"], key, 26, 25431, 56989,
                    93, 32589, 784152) + '&'
            elif (int(item[1]) == 4):
                sLink = sLink + item[0] + '=' + __decrypt(
                    aData["settings"]["banner"]["g_ads"]["time"],
                    aData["settings"]["config"]["rkts"], key, 82, 84669, 48779,
                    32, 65598, 115498) + '&'
            elif (int(item[1]) == 5):
                sLink = sLink + item[0] + '=' + __decrypt(
                    aData["settings"]["login_status"]["euno"],
                    aData["settings"]["login_status"]["pepper"], key, 10,
                    12254, 95369, 39, 21544, 545555) + '&'
            elif (int(item[1]) == 6):
                sLink = sLink + item[0] + '=' + __decrypt(
                    aData["settings"]["login_status"]["sugar"],
                    aData["settings"]["banner"]["lightbox2"]["time"], key, 22,
                    66595, 17447, 52, 66852, 400595) + '&'

        sLink = sLink + "start=0"

        stream_url = stream_url_part1 + '&' + sLink

        return [{'url': stream_url}]
Beispiel #5
0
def resolve(url):
    m = _regex(url)
    if m:
        util.init_urllib()
        data = util.request(url)
        if data.find('Toto video neexistuje') > 0:
            util.error('Video bylo smazano ze serveru')
            return
        player = 'http://www.streamuj.tv/new-flash-player/mplugin4.swf'
        headers = {
            'User-Agent':
            util.UA,
            'Referer':
            'http://www.streamuj.tv/mediaplayer/player.swf',
            'Cookie':
            ','.join("%s=%s" % (c.name, c.value) for c in util._cookie_jar)
        }
        index = 0
        result = []
        qualities = re.search(r'rn\:[^\"]*\"([^\"]*)', data,
                              re.IGNORECASE | re.DOTALL)
        langs = re.search(r'langs\:[^\"]*\"([^\"]+)', data,
                          re.IGNORECASE | re.DOTALL)
        languages = [
            ''
        ]  # pretend there is at least language so we read 1st stream info
        if langs:
            languages = langs.group(1).split(',')
        for language in languages:
            streams = re.search(
                r'res{index}\:[^\"]*\"([^\"]+)'.format(index=index), data,
                re.IGNORECASE | re.DOTALL)
            subs = re.search(
                r'sub{index}\:[^\"]*\"([^\"]+)'.format(index=index), data,
                re.IGNORECASE | re.DOTALL)
            if subs:
                subs = re.search(r'[^>]+>([^,$]+)', subs.group(1),
                                 re.IGNORECASE | re.DOTALL)
            else:
                subs = None
            if streams and qualities:
                streams = streams.group(1).split(',')
                rn = qualities.group(1).split(',')
                qindex = 0
                for stream in streams:
                    q = rn[qindex]
                    if q == 'HD':
                        q = '720p'
                    else:
                        q = 'SD'
                    item = {
                        'url': stream,
                        'quality': q,
                        'headers': headers,
                        'lang': language
                    }
                    if subs:
                        link = subs.group(1)
                        item['lang'] += ' + subs'
                        item['subs'] = link
                    result.append(item)
                    qindex += 1
            index += 1
        return result