示例#1
0
def thevideo(videoId, encHeaders=''):
    headers = {
        'User-Agent': DESKTOP_BROWSER,
        'Referer': 'http://thevideo.me/%s' % videoId
    }
    encodeHeaders = urllib.urlencode(headers)
    urlStr = 'http://thevideo.me/%s<headers>%s' % (videoId, encodeHeaders)
    content = basicFunc.openUrl(urlStr)[1]
    pattern = r'''name: '(?P<var1>[^']+)', value: '(?P<var2>[^']+)' \}\).prependTo\(\"#veriform\"\)'''
    formVars = CustomRegEx.findall(pattern, content)
    pattern = r"(?#<form .input<name=var1 value=var2>*>)"
    formVars.extend(CustomRegEx.findall(pattern, content))
    pattern = r"\$\.cookie\(\'(?P<var1>[^']+)\', \'(?P<var2>[^']+)\'"
    cookieval = CustomRegEx.findall(pattern, content)
    qte = urllib.quote
    postdata = '&'.join(
        map(lambda x: '='.join(x),
            [(var1, qte(var2) if var2 else '') for var1, var2 in formVars]))
    headers['Cookie'] = '; '.join(map(lambda x: '='.join(x), cookieval))
    encodeHeaders = urllib.urlencode(headers)
    urlStr = 'http://thevideo.me/%s<post>%s<headers>%s' % (videoId, postdata,
                                                           encodeHeaders)
    content = basicFunc.openUrl(urlStr)[1]
    pattern = r"label: '(?P<res>[^']+)', file: '(?P<url>[^']+)'"
    sources = CustomRegEx.findall(pattern, content)
    res, href = sources.pop()
    return href
    pass
示例#2
0
def allmyvideos(videoId, headers = None):
    headers = headers or {}
    headers['User-Agent'] = MOBILE_BROWSER
    encodeHeaders = urllib.urlencode(headers) 
    url = 'http://allmyvideos.net/%s<headers>%s' % (videoId, encodeHeaders)
    content = basicFunc.openUrl(url)[1]
    pattern = r'(?#<form .input<name=name value=value>*>)'
    formVars = CustomRegEx.findall(pattern, content)
    qte = urllib.quote
    postdata = '&'.join(map(lambda x: '='.join(x),[(var1, qte(var2) if var2 else '') for var1, var2 in formVars]))
    urlStr = 'http://allmyvideos.net/%s<post>%s<headers>%s' % (videoId, postdata, encodeHeaders)
    content = basicFunc.openUrl(urlStr)[1]
    pattern = r'"file" : "(?P<url>[^"]+)".+?"label" : "(?P<label>[^"]+)"'
    sources = re.findall(pattern, content, re.DOTALL)
    href, res = sources.pop()
    urlStr = '%s|%s' % (href,urllib.urlencode({'User-Agent':MOBILE_BROWSER}))
    return urlStr
    pass
示例#3
0
def vidto(videoId, headers = None):
    headers = headers or {}
    headers['User-Agent'] = MOBILE_BROWSER
    encodeHeaders = urllib.urlencode(headers) 
    url = 'http://vidto.me/%s.html<headers>%s' % (videoId, encodeHeaders)
    content = basicFunc.openUrl(url)[1]
    pattern = r'(?#<Form method="POST".input<type="hidden" name=name value=value>*>)'
    formVars = CustomRegEx.findall(pattern, content)
    qte = urllib.quote
    postdata = '&'.join(map(lambda x: '='.join(x),[(var1, qte(var2) if var2 else '') for var1, var2 in formVars]))
    urlStr = 'http://vidto.me/%s.html<post>%s<headers>%s' % (videoId, postdata, encodeHeaders)
    content = basicFunc.openUrl(urlStr)[1]
    pattern = r'(?#<a class="player-url" href=url>)'
    sources = CustomRegEx.findall(pattern, content, re.DOTALL)
    href = sources.pop()
    urlStr = '%s|%s' % (href,urllib.urlencode({'User-Agent':MOBILE_BROWSER}))
    return urlStr
    pass
示例#4
0
def netu(videoId, encHeaders=''):
    headers = {
        'Accept':
        'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
        'Content-Type': 'text/html; charset=utf-8'
    }
    player_url = "http://hqq.tv/player/embed_player.php?vid=%s&autoplay=no" % videoId
    data = basicFunc.openUrl(player_url, False)[1]
    b64enc = re.search('base64([^\"]+)', data, re.DOTALL)
    b64dec = b64enc and base64.decodestring(b64enc.group(1))
    enc = b64dec and re.search("\'([^']+)\'", b64dec).group(1)
    if not enc: return ''
    escape = re.search("var _escape=\'([^\']+)",
                       base64.decodestring(enc[::-1])).group(1)
    escape = escape.replace('%', '\\').decode('unicode-escape')
    data = re.findall('<input name="([^"]+?)" [^>]+? value="([^"]*?)">',
                      escape)
    post_data = dict(data)
    totUrl = player_url + '<post>' + urllib.urlencode(post_data)
    data = basicFunc.openUrl(totUrl, False)[1]
    data = re.sub('unescape\("([%0-9a-z]+)"\)',
                  lambda x: urlparse.unquote(x.group(1)), data)
    vid_server = re.search(r'var\s*vid_server\s*=\s*"([^"]*?)"', data)
    vid_link = re.search(r'var\s*vid_link\s*=\s*"([^"]*?)"', data)
    at = re.search(r'var\s*at\s*=\s*"([^"]*?)"', data)
    if not (vid_server and vid_link and at): return ''
    get_data = {
        'server': vid_server.group(1),
        'link': vid_link.group(1),
        'at': at.group(1),
        'b': '1',
        'adb': '0/',
        'vid': videoId
    }
    totUrl = "http://hqq.tv/player/get_md5.php?" + urllib.urlencode(get_data)
    data = basicFunc.openUrl(totUrl, False)[1]
    data = json.load(StringIO(data))
    if 'file' not in data: return ''
    dec_a = 'GLMNZoItVyxpRmzuD7WvQne0b='
    dec_b = '26ik8XJBasdHwfT3lc5Yg149UA'
    t1 = string.maketrans(dec_a + dec_b, dec_b + dec_a)
    encUrlStr = str(data['file']).translate(t1)
    urlStr = base64.decodestring(encUrlStr) + '='
    return urlStr + '|' + urllib.urlencode({'User-Agent': MOBILE_BROWSER})
示例#5
0
def vidto(videoId, headers=None):
    headers = headers or {}
    headers['User-Agent'] = MOBILE_BROWSER
    encodeHeaders = urllib.urlencode(headers)
    url = 'http://vidto.me/%s.html<headers>%s' % (videoId, encodeHeaders)
    content = basicFunc.openUrl(url)[1]
    pattern = r'(?#<Form method="POST".input<type="hidden" name=name value=value>*>)'
    formVars = CustomRegEx.findall(pattern, content)
    qte = urllib.quote
    postdata = '&'.join(
        map(lambda x: '='.join(x),
            [(var1, qte(var2) if var2 else '') for var1, var2 in formVars]))
    urlStr = 'http://vidto.me/%s.html<post>%s<headers>%s' % (videoId, postdata,
                                                             encodeHeaders)
    content = basicFunc.openUrl(urlStr)[1]
    pattern = r'(?#<a class="player-url" href=url>)'
    sources = CustomRegEx.findall(pattern, content, re.DOTALL)
    href = sources.pop()
    urlStr = '%s|%s' % (href, urllib.urlencode({'User-Agent': MOBILE_BROWSER}))
    return urlStr
    pass
示例#6
0
def allmyvideos(videoId, headers=None):
    headers = headers or {}
    headers['User-Agent'] = MOBILE_BROWSER
    encodeHeaders = urllib.urlencode(headers)
    url = 'http://allmyvideos.net/%s<headers>%s' % (videoId, encodeHeaders)
    content = basicFunc.openUrl(url)[1]
    pattern = r'(?#<form .input<name=name value=value>*>)'
    formVars = CustomRegEx.findall(pattern, content)
    qte = urllib.quote
    postdata = '&'.join(
        map(lambda x: '='.join(x),
            [(var1, qte(var2) if var2 else '') for var1, var2 in formVars]))
    urlStr = 'http://allmyvideos.net/%s<post>%s<headers>%s' % (
        videoId, postdata, encodeHeaders)
    content = basicFunc.openUrl(urlStr)[1]
    pattern = r'"file" : "(?P<url>[^"]+)".+?"label" : "(?P<label>[^"]+)"'
    sources = re.findall(pattern, content, re.DOTALL)
    href, res = sources.pop()
    urlStr = '%s|%s' % (href, urllib.urlencode({'User-Agent': MOBILE_BROWSER}))
    return urlStr
    pass
示例#7
0
def thevideo(videoId, encHeaders = ''):
    headers = {'User-Agent':DESKTOP_BROWSER, 
               'Referer': 'http://thevideo.me/%s' % videoId}
    encodeHeaders = urllib.urlencode(headers)
    urlStr = 'http://thevideo.me/%s<headers>%s' % (videoId, encodeHeaders)
    content = basicFunc.openUrl(urlStr)[1]
    pattern = r'''name: '(?P<var1>[^']+)', value: '(?P<var2>[^']+)' \}\).prependTo\(\"#veriform\"\)'''
    formVars = CustomRegEx.findall(pattern, content)
    pattern = r"(?#<form .input<name=var1 value=var2>*>)"
    formVars.extend(CustomRegEx.findall(pattern, content))   
    pattern = r"\$\.cookie\(\'(?P<var1>[^']+)\', \'(?P<var2>[^']+)\'"
    cookieval = CustomRegEx.findall(pattern, content)
    qte = urllib.quote
    postdata = '&'.join(map(lambda x: '='.join(x),[(var1, qte(var2) if var2 else '') for var1, var2 in formVars]))
    headers['Cookie'] = '; '.join(map(lambda x: '='.join(x),cookieval))
    encodeHeaders = urllib.urlencode(headers)
    urlStr = 'http://thevideo.me/%s<post>%s<headers>%s' % (videoId, postdata, encodeHeaders)
    content = basicFunc.openUrl(urlStr)[1]
    pattern = r"label: '(?P<res>[^']+)', file: '(?P<url>[^']+)'"
    sources = CustomRegEx.findall(pattern, content)
    res, href = sources.pop()
    return href
    pass
示例#8
0
def netu(videoId, encHeaders = ''):
    headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
               'Content-Type': 'text/html; charset=utf-8'}
    player_url = "http://hqq.tv/player/embed_player.php?vid=%s&autoplay=no" % videoId
    data = basicFunc.openUrl(player_url, False)[1]
    b64enc = re.search('base64([^\"]+)', data, re.DOTALL)
    b64dec = b64enc and base64.decodestring(b64enc.group(1))
    enc = b64dec and re.search("\'([^']+)\'", b64dec).group(1)
    if not enc: return ''
    escape = re.search("var _escape=\'([^\']+)", base64.decodestring(enc[::-1])).group(1)
    escape = escape.replace('%', '\\').decode('unicode-escape')
    data = re.findall('<input name="([^"]+?)" [^>]+? value="([^"]*?)">', escape)
    post_data = dict(data)
    totUrl = player_url + '<post>' + urllib.urlencode(post_data)
    data = basicFunc.openUrl(totUrl, False)[1]
    data = re.sub('unescape\("([%0-9a-z]+)"\)', lambda x: urlparse.unquote(x.group(1)), data)
    vid_server = re.search(r'var\s*vid_server\s*=\s*"([^"]*?)"', data)
    vid_link = re.search(r'var\s*vid_link\s*=\s*"([^"]*?)"', data)
    at = re.search(r'var\s*at\s*=\s*"([^"]*?)"', data)
    if not (vid_server and vid_link and at): return ''
    get_data = {'server': vid_server.group(1),
                'link': vid_link.group(1),
                'at': at.group(1),
                'b': '1',
                'adb': '0/',
                'vid':videoId
                }
    totUrl = "http://hqq.tv/player/get_md5.php?" + urllib.urlencode(get_data)
    data = basicFunc.openUrl(totUrl, False)[1]
    data = json.load(StringIO(data))                
    if 'file' not in data: return ''
    dec_a = 'GLMNZoItVyxpRmzuD7WvQne0b='
    dec_b = '26ik8XJBasdHwfT3lc5Yg149UA'
    t1 = string.maketrans(dec_a + dec_b, dec_b + dec_a)
    encUrlStr = str(data['file']).translate(t1)
    urlStr = base64.decodestring(encUrlStr) + '='
    return urlStr + '|' + urllib.urlencode({'User-Agent':MOBILE_BROWSER})
示例#9
0
def videomega(videoId, headers = None):
    strVal = '0123456789abcdefghijklmnopqrstuvwxyz'
    headers = headers or {}
    headers['User-Agent'] = MOBILE_BROWSER
    url = 'http://videomega.tv/cdn.php?ref=%s<headers>%s' % (videoId, urllib.urlencode(headers))
    content = basicFunc.openUrl(url)[1]
    pattern = "\(\'(?P<patron>\$.+?;)\'.+?\'(?P<lista>.+?)\'"
    m = re.search(pattern, content)
    patron, lista = m.groups()
    lista = lista.split('|')
    repFunc = lambda x: lista[strVal.index(x.group())] or x.group()
    content = re.sub(r'\b\w+\b', repFunc, patron)
    m = re.search('\"(http.+?)\"', content)
    urlStr = m.group(1) + '|' + headers['User-Agent']
    return urlStr
示例#10
0
def videomega(videoId, headers=None):
    strVal = '0123456789abcdefghijklmnopqrstuvwxyz'
    headers = headers or {}
    headers['User-Agent'] = MOBILE_BROWSER
    url = 'http://videomega.tv/cdn.php?ref=%s<headers>%s' % (
        videoId, urllib.urlencode(headers))
    content = basicFunc.openUrl(url)[1]
    pattern = "\(\'(?P<patron>\$.+?;)\'.+?\'(?P<lista>.+?)\'"
    m = re.search(pattern, content)
    patron, lista = m.groups()
    lista = lista.split('|')
    repFunc = lambda x: lista[strVal.index(x.group())] or x.group()
    content = re.sub(r'\b\w+\b', repFunc, patron)
    m = re.search('\"(http.+?)\"', content)
    urlStr = m.group(1) + '|' + headers['User-Agent']
    return urlStr
示例#11
0
def up2stream(videoId, encHeaders = ''):
    strVal = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    urlStr = 'http://up2stream.com/cdn.php?ref=%s&width=607&height=360&hd=1' % videoId
    content = basicFunc.openUrl(urlStr)[1]
    pattern = r"}\((?P<tupla>\'.+?\)),0,{}"
    m = re.search(pattern, content)
    mgrp = m.group(1).rsplit(',', 3)
    patron, base, nTags, lista = mgrp[0], int(mgrp[1]), int(mgrp[2]), eval(mgrp[3])  
    while nTags:
        nTags -= 1
        tag = strVal[nTags] if nTags < base else strVal[nTags/base] + strVal[nTags%base]
        patron = re.sub('\\b' + tag + '\\b', lista[nTags] or tag, patron)
    pattern = r'"(http[^"]+)"'
    m = re.search(pattern, patron)
    urlStr = m.group(1)
    return urlStr
示例#12
0
def powvideo(videoId, encHeaders = ''):
    strVal = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    urlStr  = 'http://powvideo.net/iframe-%s-607x360.html' % videoId
    headers = {'Referer':'http://powvideo.net/preview-%s-607x360.html' % videoId}
    urlStr += '<headers>' + urllib.urlencode(headers)
    content = basicFunc.openUrl(urlStr)[1]
    pattern = r"}\((?P<tupla>.+?\))\)\)"
    m = re.search(pattern, content)
    mgrp = m.group(1).rsplit(',', 3)
    patron, base, nTags, lista = mgrp[0], int(mgrp[1]), int(mgrp[2]), eval(mgrp[3])  
    while nTags:
        nTags -= 1
        tag = strVal[nTags] if nTags < base else strVal[nTags/base] + strVal[nTags%base] 
        patron = re.sub('\\b' + tag + '\\b', lista[nTags] or tag, patron)
    pattern = r"(?P<url>http:[^']+\.m3u8)"
    m = re.search(pattern, patron)
    urlStr = m.group(1)
    return urlStr
示例#13
0
def gamovideo(videoId, encHeaders = ''):
    strVal = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    headers = {'User-Agent':MOBILE_BROWSER}
    encodeHeaders = urllib.urlencode(headers)
    urlStr = 'http://gamovideo.com/embed-%s-607x360.html<headers>%s' % (videoId, encodeHeaders)
    pattern = r"}\((?P<tupla>.+?\))\)\)"
    content = basicFunc.openUrl(urlStr)[1]
    m = re.search(pattern, content)
    mgrp = m.group(1).rsplit(',', 3)
    patron, base, nTags, lista = mgrp[0], int(mgrp[1]), int(mgrp[2]), eval(mgrp[3])  
    while nTags:
        nTags -= 1
        tag = strVal[nTags] if nTags < base else strVal[nTags/base] + strVal[nTags%base]
        patron = re.sub('\\b' + tag + '\\b', lista[nTags] or tag, patron)
    pattern = r'file:"(?P<url>http:[^"]+\.mp4)"'
    m = re.search(pattern, patron)
    urlStr = m.group(1) + '|' + urllib.urlencode({'User-Agent':MOBILE_BROWSER})
    return urlStr
示例#14
0
def up2stream(videoId, encHeaders=''):
    strVal = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    urlStr = 'http://up2stream.com/cdn.php?ref=%s&width=607&height=360&hd=1' % videoId
    content = basicFunc.openUrl(urlStr)[1]
    pattern = r"}\((?P<tupla>\'.+?\)),0,{}"
    m = re.search(pattern, content)
    mgrp = m.group(1).rsplit(',', 3)
    patron, base, nTags, lista = mgrp[0], int(mgrp[1]), int(mgrp[2]), eval(
        mgrp[3])
    while nTags:
        nTags -= 1
        tag = strVal[nTags] if nTags < base else strVal[nTags /
                                                        base] + strVal[nTags %
                                                                       base]
        patron = re.sub('\\b' + tag + '\\b', lista[nTags] or tag, patron)
    pattern = r'"(http[^"]+)"'
    m = re.search(pattern, patron)
    urlStr = m.group(1)
    return urlStr
示例#15
0
def putstream(videoId, headers = None):
    headers = headers or {}
    headers['User-Agent'] = MOBILE_BROWSER
    encodeHeaders = urllib.urlencode(headers)
    urlStr = 'http://putstream.com/embed-%s.html<headers>%s' % (videoId, encodeHeaders)
#     content = basicFunc.openUrl(urlStr)[1]    
#     pattern = r'(?#<Form .input<type="hidden" name=name value=value>*>)'
#     formVars = CustomRegEx.findall(pattern, content)
#     qte = urllib.quote
#     headers['Referer'] = 'http://putstream.com/%s.html' % videoId
#     postdata = '&'.join(map(lambda x: '='.join(x),[(var1, qte(var2) if var2 else '') for var1, var2 in formVars]))
#     urlStr = 'http://putstream.com/dl<post>%s<headers>%s' % (postdata, encodeHeaders)
    content = basicFunc.openUrl(urlStr)[1]
    pattern = r'file:"([^"]+)",label:"([^"]+)"'
    sources = re.findall(pattern, content)
    if not sources: return ''
    href, resol = sources.pop()
    headers = {'User-Agent':MOBILE_BROWSER}
    urlStr = '%s|%s' % (href,urllib.urlencode(headers))
    return urlStr
示例#16
0
def vidzi(videoId, headers = None):
    strVal = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    headers = headers or {}
    headers['User-Agent'] = MOBILE_BROWSER
    encodeHeaders = urllib.urlencode(headers) 
    url = 'http://vidzi.tv/%s.html<headers>%s' % (videoId, encodeHeaders)
    content = basicFunc.openUrl(url)[1]
    pattern = r"(?#<script *='eval.+?'=pack>)"
    packed = CustomRegEx.search(pattern, content).group('pack')
    pattern = "}\((?P<tupla>\'.+?\))(?:,0,{})*\)"
    m = re.search(pattern, packed)
    mgrp = m.group(1).rsplit(',', 3)
    patron, base, nTags, lista = mgrp[0], int(mgrp[1]), int(mgrp[2]), eval(mgrp[3])  
    while nTags:
        nTags -= 1
        tag = strVal[nTags] if nTags < base else strVal[nTags/base] + strVal[nTags%base]
        patron = re.sub('\\b' + tag + '\\b', lista[nTags] or tag, patron)
    pattern = 'file:"([^"]+(?:mp4|ed=))"'
    sources = CustomRegEx.findall(pattern,patron)
    return sources.pop()
示例#17
0
def putstream(videoId, headers=None):
    headers = headers or {}
    headers['User-Agent'] = MOBILE_BROWSER
    encodeHeaders = urllib.urlencode(headers)
    urlStr = 'http://putstream.com/embed-%s.html<headers>%s' % (videoId,
                                                                encodeHeaders)
    #     content = basicFunc.openUrl(urlStr)[1]
    #     pattern = r'(?#<Form .input<type="hidden" name=name value=value>*>)'
    #     formVars = CustomRegEx.findall(pattern, content)
    #     qte = urllib.quote
    #     headers['Referer'] = 'http://putstream.com/%s.html' % videoId
    #     postdata = '&'.join(map(lambda x: '='.join(x),[(var1, qte(var2) if var2 else '') for var1, var2 in formVars]))
    #     urlStr = 'http://putstream.com/dl<post>%s<headers>%s' % (postdata, encodeHeaders)
    content = basicFunc.openUrl(urlStr)[1]
    pattern = r'file:"([^"]+)",label:"([^"]+)"'
    sources = re.findall(pattern, content)
    if not sources: return ''
    href, resol = sources.pop()
    headers = {'User-Agent': MOBILE_BROWSER}
    urlStr = '%s|%s' % (href, urllib.urlencode(headers))
    return urlStr
示例#18
0
def powvideo(videoId, encHeaders=''):
    strVal = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    urlStr = 'http://powvideo.net/iframe-%s-607x360.html' % videoId
    headers = {
        'Referer': 'http://powvideo.net/preview-%s-607x360.html' % videoId
    }
    urlStr += '<headers>' + urllib.urlencode(headers)
    content = basicFunc.openUrl(urlStr)[1]
    pattern = r"}\((?P<tupla>.+?\))\)\)"
    m = re.search(pattern, content)
    mgrp = m.group(1).rsplit(',', 3)
    patron, base, nTags, lista = mgrp[0], int(mgrp[1]), int(mgrp[2]), eval(
        mgrp[3])
    while nTags:
        nTags -= 1
        tag = strVal[nTags] if nTags < base else strVal[nTags /
                                                        base] + strVal[nTags %
                                                                       base]
        patron = re.sub('\\b' + tag + '\\b', lista[nTags] or tag, patron)
    pattern = r"(?P<url>http:[^']+\.m3u8)"
    m = re.search(pattern, patron)
    urlStr = m.group(1)
    return urlStr
示例#19
0
def gamovideo(videoId, encHeaders=''):
    strVal = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    headers = {'User-Agent': MOBILE_BROWSER}
    encodeHeaders = urllib.urlencode(headers)
    urlStr = 'http://gamovideo.com/embed-%s-607x360.html<headers>%s' % (
        videoId, encodeHeaders)
    pattern = r"}\((?P<tupla>.+?\))\)\)"
    content = basicFunc.openUrl(urlStr)[1]
    m = re.search(pattern, content)
    mgrp = m.group(1).rsplit(',', 3)
    patron, base, nTags, lista = mgrp[0], int(mgrp[1]), int(mgrp[2]), eval(
        mgrp[3])
    while nTags:
        nTags -= 1
        tag = strVal[nTags] if nTags < base else strVal[nTags /
                                                        base] + strVal[nTags %
                                                                       base]
        patron = re.sub('\\b' + tag + '\\b', lista[nTags] or tag, patron)
    pattern = r'file:"(?P<url>http:[^"]+\.mp4)"'
    m = re.search(pattern, patron)
    urlStr = m.group(1) + '|' + urllib.urlencode(
        {'User-Agent': MOBILE_BROWSER})
    return urlStr
示例#20
0
def vidzi(videoId, headers=None):
    strVal = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    headers = headers or {}
    headers['User-Agent'] = MOBILE_BROWSER
    encodeHeaders = urllib.urlencode(headers)
    url = 'http://vidzi.tv/%s.html<headers>%s' % (videoId, encodeHeaders)
    content = basicFunc.openUrl(url)[1]
    pattern = r"(?#<script *='eval.+?'=pack>)"
    packed = CustomRegEx.search(pattern, content).group('pack')
    pattern = "}\((?P<tupla>\'.+?\))(?:,0,{})*\)"
    m = re.search(pattern, packed)
    mgrp = m.group(1).rsplit(',', 3)
    patron, base, nTags, lista = mgrp[0], int(mgrp[1]), int(mgrp[2]), eval(
        mgrp[3])
    while nTags:
        nTags -= 1
        tag = strVal[nTags] if nTags < base else strVal[nTags /
                                                        base] + strVal[nTags %
                                                                       base]
        patron = re.sub('\\b' + tag + '\\b', lista[nTags] or tag, patron)
    pattern = 'file:"([^"]+(?:mp4|ed=))"'
    sources = CustomRegEx.findall(pattern, patron)
    return sources.pop()
示例#21
0
    def openloadORIG(videoId, encHeaders = ''):
        headers = {'User-Agent':MOBILE_BROWSER}
        encodeHeaders = urllib.urlencode(headers)
        urlStr = 'https://openload.co/embed/%s/<headers>%s' % (videoId, encodeHeaders)
        content = basicFunc.openUrl(urlStr)[1]    
        varTags = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
        pattern = r'(?#<video script.*=puzzle>)'
        puzzle = CustomRegEx.findall(pattern, content)[0]
        vars = sorted(set(re.findall(r'\(([^=)(]+)\) *=', puzzle)))
        keys1 = re.findall(r', *(?P<key>[^: ]+) *:', puzzle)
        keys2 = re.findall(r"\(゚Д゚\) *\[[^']+\] *=", puzzle)
        keys = sorted(set(keys1 + keys2))
        totVars = vars + keys
        for k in range(len(vars)):
            puzzle = puzzle.replace(vars[k], varTags[k])
        for k in range(len(keys)):
            puzzle = puzzle.replace(keys[k], varTags[-k - 1])
    #     puzzle = puzzle.replace('\xef\xbe\x89'.decode('utf-8'), '').replace(' ','')
        puzzle = re.sub(r'[ \x80-\xff]','',puzzle)
        pat_dicId = r'\(([A-Z])\)={'
        m = re.search(pat_dicId, puzzle)
        assert m, 'No se encontro Id del diccionario'
        dicId = m.group(1)
    #     pat_obj = r"\(\(%s\)\+\\'_\\'\)" % dicId
        dic_pat1 = r"\(\(%s\)\+\'_\'\)" % dicId
        dic_pat2 = r"\(%s\+([^+)]+)\)" % dicId
        dic_pat3 = r"\(%s\)\.(.+?)\b" % dicId
        dic_pat4 = r"(?<=[{,])([^: ]+)(?=:)"
        
        puzzle = re.sub(dic_pat1, "'[object object]_'", puzzle)
        puzzle = re.sub(dic_pat2, lambda x: "('[object object]'+str(%s))" % x.group(1), puzzle)
        puzzle = re.sub(dic_pat3, lambda x: "(%s)['%s']" % (dicId, x.group(1)), puzzle)
        puzzle = re.sub(dic_pat4, lambda x: "'%s'" % x.group(1), puzzle)
    
        pat_str1 = r"\((\(.+?\)|[A-Z])\+\'_\'\)"
        pat_str2 = r"\([^()]+\)\[[A-Z]\]\[[A-Z]\]"
        puzzle = re.sub(pat_str1, lambda x: "(str(%s)+'_')" % x.group(1), puzzle)
        puzzle = re.sub(pat_str2, "'function'", puzzle)
    
        codeGlb = {}    
        code = puzzle.split(';')
        code.pop()
        code[0] = code[0][:2] + "'undefined'"
#         for k, linea in enumerate(code[:-1]):
#             try:
#                 exec(linea, codeGlb)
#             except:
#                 print 'Linea %s con errores ' % k, linea
#                 code[k] = linea.split('=')[0] + '=' + "'\\\\'"
#                 print 'Se corrige como ', code[k]
#                 exec(code[k], codeGlb)
        
        linea = code[-1]
        linea = re.sub(r"\(([A-Z]+)\)", lambda x: x.group(1), linea)
        linea = re.sub(r"\([oc]\^_\^o\)", lambda x: "%s" % eval(x.group(), codeGlb), linea)
        while re.search(r"\([^)\]'\[(]+\)", linea):        
            linea = re.sub(r"\([^)\]'\[(]+\)", lambda x: "%s" % eval(x.group(), codeGlb), linea)
        linea = re.sub(r"[A-Z](?=[^\]\[])", lambda x: "%s" % eval(x.group(), codeGlb), linea)
        linea = re.sub(r"E\[[\'_A-Z]+\]", lambda x: "%s" % eval(x.group(), codeGlb), linea)
        linea = linea.replace('+', '')
        linea = linea.decode('unicode-escape')
        m = re.search(r'http.+?true', linea)
        urlStr = '%s|%s' % (m.group(),encodeHeaders)
        return urlStr
示例#22
0
def openload(videoId, headers = None):
    headers = headers or {}
    headers['User-Agent'] = MOBILE_BROWSER
    encodeHeaders = urllib.urlencode(headers)
    urlStr = 'https://openload.co/embed/%s/<headers>%s' % (videoId, encodeHeaders)
    content = basicFunc.openUrl(urlStr)[1]    
    varTags = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    pattern = r'(?#<video script.*=puzzle>)'
    puzzle = CustomRegEx.findall(pattern, content)[0]
    vars = sorted(set(re.findall(r'\(([^=)(]+)\) *=', puzzle)))
    keys1 = re.findall(r', *(?P<key>[^: ]+) *:', puzzle)
    keys2 = re.findall(r"\(゚Д゚\) *\[[^']+\] *=", puzzle)
    keys = sorted(set(keys1 + keys2))
    totVars = vars + keys
    for k in range(len(vars)):
        puzzle = puzzle.replace(vars[k], varTags[k])
    for k in range(len(keys)):
        puzzle = puzzle.replace(keys[k], varTags[-k - 1])
#     puzzle = puzzle.replace('\xef\xbe\x89'.decode('utf-8'), '').replace(' ','')
    puzzle = re.sub(r'[ \x80-\xff]','',puzzle)
    pat_dicId = r'\(([A-Z])\)={'
    m = re.search(pat_dicId, puzzle)
    assert m, 'No se encontro Id del diccionario'
    dicId = m.group(1)
#     pat_obj = r"\(\(%s\)\+\\'_\\'\)" % dicId
    dic_pat1 = r"\(\(%s\)\+\'_\'\)" % dicId
    dic_pat2 = r"\(%s\+([^+)]+)\)" % dicId
    dic_pat3 = r"\(%s\)\.(.+?)\b" % dicId
    dic_pat4 = r"(?<=[{,])([^: ]+)(?=:)"
    
    puzzle = re.sub(dic_pat1, "'[object object]_'", puzzle)
    puzzle = re.sub(dic_pat2, lambda x: "('[object object]'+str((%s)))" % x.group(1), puzzle)
    puzzle = re.sub(dic_pat3, lambda x: "(%s)['%s']" % (dicId, x.group(1)), puzzle)
    puzzle = re.sub(dic_pat4, lambda x: "'%s'" % x.group(1), puzzle)

    pat_str1 = r"\((\(.+?\)|[A-Z])\+\'_\'\)"
    pat_str2 = r"\([^()]+\)\[[A-Z]\]\[[A-Z]\]"
    pat_str3 = r"(?<=;)([^+]+)\+=([^;]+)"
    puzzle = re.sub(pat_str1, lambda x: "(str((%s))+'_')" % x.group(1), puzzle)
    puzzle = re.sub(pat_str2, "'function'", puzzle)
    puzzle = re.sub(pat_str3, lambda x: "%s=%s+%s" % (x.group(1), x.group(1), x.group(2)), puzzle)

    codeGlb = {}    
    code = puzzle.split(';')
    code.pop()
    code[0] = code[0][:2] + "'undefined'"
    for linea in code[:-1]:
        linea = re.sub(r"\(([A-Z]+)\)", lambda x: x.group(1), linea)
        varss = re.split(r"(?<=[_a-zA-Z\]])=(?=[^=])",linea)
        value = eval(varss.pop(), codeGlb)
        for var in varss:
            m = re.match(r"([^\[]+)\[([^\]]+)\]", var)
            if m:
                var, key = m.groups()
                key = eval(key, codeGlb)
                codeGlb[var][key] = value
            else:
                codeGlb[var] = value
        
    
    linea = code[-1]
    linea = re.sub(r"\(([A-Z]+)\)", lambda x: x.group(1), linea)
    linea = re.sub(r"\([oc]\^_\^o\)", lambda x: "%s" % eval(x.group(), codeGlb), linea)
    while re.search(r"\([^)\]'\[(]+\)", linea):        
        linea = re.sub(r"\([^)\]'\[(]+\)", lambda x: "%s" % eval(x.group(), codeGlb), linea)
    linea = re.sub(r"[A-Z](?=[^\]\[])", lambda x: "%s" % eval(x.group(), codeGlb), linea)
    linea = re.sub(r"E\[[\'_A-Z]+\]", lambda x: "%s" % eval(x.group(), codeGlb), linea)
    linea = linea.replace('+', '')
    linea = linea.decode('unicode-escape')
    m = re.search(r'http.+?true', linea)
    urlStr = basicFunc.openUrl(m.group(), True)
    urlStr = '%s|%s' % (m.group(),urllib.urlencode({'User-Agent':MOBILE_BROWSER}))
    return urlStr    
示例#23
0
def getCurlCommand(baseUrlStr, formAttr, formFields, otherOptions = ''):
    if formAttr.has_key('action'):
        baseUrlStr = urlparse.urljoin(baseUrlStr, formAttr['action'])
    if formAttr.get('method', 'POST').upper() != 'POST':
        otherOptions += ' --get'
        pass
    datafrm = '--data-urlencode "%s=%s"'
    if formAttr.get('enctype', '').lower() == 'multipart/form-data':
        datafrm = '--form "%s=%s"'
        pass
    postData = ' '.join(datafrm % (item[0], item[1].encode('utf-8')) for item in formFields)
    return 'curl "{0}" {1} {2} --compressed'.format(baseUrlStr, postData, otherOptions)

if __name__ == '__main__':
    baseUrl = 'https://lastpass.com/?ac=1&lpnorefresh=1'
    content = basicFunc.openUrl(baseUrl)[1]

    Root = tk.Tk()
    form_xml = getFormXmlStr(content)
    print(form_xml)
    browser = AppSettingDialog(Root, form_xml, isFile = False, settings = {}, title = 'Form Detector In Develovment', dheight = 600, dwidth = 800)
    print('***Result***')
    pprint.pprint(browser.result)
    print('***AllSettings***')
    pprint.pprint(browser.allSettings)
    if browser.allSettings:
        formAttr = dict([(key[3:], value) for key, value in browser.allSettings if key.startswith('fa_')])
        formFields = [item for item in browser.allSettings if not item[0].startswith('fa_')]
        pprint.pprint(formAttr)
        pprint.pprint(formFields)
        print getCurlCommand(baseUrl, formAttr, formFields)
示例#24
0
def openload(videoId, headers=None):
    headers = headers or {}
    headers['User-Agent'] = MOBILE_BROWSER
    encodeHeaders = urllib.urlencode(headers)
    urlStr = 'https://openload.co/embed/%s/<headers>%s' % (videoId,
                                                           encodeHeaders)
    content = basicFunc.openUrl(urlStr)[1]
    varTags = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    pattern = r'(?#<video script.*=puzzle>)'
    puzzle = CustomRegEx.findall(pattern, content)[0]
    vars = sorted(set(re.findall(r'\(([^=)(]+)\) *=', puzzle)))
    keys1 = re.findall(r', *(?P<key>[^: ]+) *:', puzzle)
    keys2 = re.findall(r"\(゚Д゚\) *\[[^']+\] *=", puzzle)
    keys = sorted(set(keys1 + keys2))
    totVars = vars + keys
    for k in range(len(vars)):
        puzzle = puzzle.replace(vars[k], varTags[k])
    for k in range(len(keys)):
        puzzle = puzzle.replace(keys[k], varTags[-k - 1])


#     puzzle = puzzle.replace('\xef\xbe\x89'.decode('utf-8'), '').replace(' ','')
    puzzle = re.sub(r'[ \x80-\xff]', '', puzzle)
    pat_dicId = r'\(([A-Z])\)={'
    m = re.search(pat_dicId, puzzle)
    assert m, 'No se encontro Id del diccionario'
    dicId = m.group(1)
    #     pat_obj = r"\(\(%s\)\+\\'_\\'\)" % dicId
    dic_pat1 = r"\(\(%s\)\+\'_\'\)" % dicId
    dic_pat2 = r"\(%s\+([^+)]+)\)" % dicId
    dic_pat3 = r"\(%s\)\.(.+?)\b" % dicId
    dic_pat4 = r"(?<=[{,])([^: ]+)(?=:)"

    puzzle = re.sub(dic_pat1, "'[object object]_'", puzzle)
    puzzle = re.sub(dic_pat2,
                    lambda x: "('[object object]'+str((%s)))" % x.group(1),
                    puzzle)
    puzzle = re.sub(dic_pat3, lambda x: "(%s)['%s']" % (dicId, x.group(1)),
                    puzzle)
    puzzle = re.sub(dic_pat4, lambda x: "'%s'" % x.group(1), puzzle)

    pat_str1 = r"\((\(.+?\)|[A-Z])\+\'_\'\)"
    pat_str2 = r"\([^()]+\)\[[A-Z]\]\[[A-Z]\]"
    pat_str3 = r"(?<=;)([^+]+)\+=([^;]+)"
    puzzle = re.sub(pat_str1, lambda x: "(str((%s))+'_')" % x.group(1), puzzle)
    puzzle = re.sub(pat_str2, "'function'", puzzle)
    puzzle = re.sub(
        pat_str3, lambda x: "%s=%s+%s" % (x.group(1), x.group(1), x.group(2)),
        puzzle)

    codeGlb = {}
    code = puzzle.split(';')
    code.pop()
    code[0] = code[0][:2] + "'undefined'"
    for linea in code[:-1]:
        linea = re.sub(r"\(([A-Z]+)\)", lambda x: x.group(1), linea)
        varss = re.split(r"(?<=[_a-zA-Z\]])=(?=[^=])", linea)
        value = eval(varss.pop(), codeGlb)
        for var in varss:
            m = re.match(r"([^\[]+)\[([^\]]+)\]", var)
            if m:
                var, key = m.groups()
                key = eval(key, codeGlb)
                codeGlb[var][key] = value
            else:
                codeGlb[var] = value

    linea = code[-1]
    linea = re.sub(r"\(([A-Z]+)\)", lambda x: x.group(1), linea)
    linea = re.sub(r"\([oc]\^_\^o\)",
                   lambda x: "%s" % eval(x.group(), codeGlb), linea)
    while re.search(r"\([^)\]'\[(]+\)", linea):
        linea = re.sub(r"\([^)\]'\[(]+\)",
                       lambda x: "%s" % eval(x.group(), codeGlb), linea)
    linea = re.sub(r"[A-Z](?=[^\]\[])",
                   lambda x: "%s" % eval(x.group(), codeGlb), linea)
    linea = re.sub(r"E\[[\'_A-Z]+\]",
                   lambda x: "%s" % eval(x.group(), codeGlb), linea)
    linea = linea.replace('+', '')
    linea = linea.decode('unicode-escape')
    m = re.search(r'http.+?true', linea)
    urlStr = basicFunc.openUrl(m.group(), True)
    urlStr = '%s|%s' % (m.group(),
                        urllib.urlencode({'User-Agent': MOBILE_BROWSER}))
    return urlStr
示例#25
0
    def openloadORIG(videoId, encHeaders=''):
        headers = {'User-Agent': MOBILE_BROWSER}
        encodeHeaders = urllib.urlencode(headers)
        urlStr = 'https://openload.co/embed/%s/<headers>%s' % (videoId,
                                                               encodeHeaders)
        content = basicFunc.openUrl(urlStr)[1]
        varTags = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
        pattern = r'(?#<video script.*=puzzle>)'
        puzzle = CustomRegEx.findall(pattern, content)[0]
        vars = sorted(set(re.findall(r'\(([^=)(]+)\) *=', puzzle)))
        keys1 = re.findall(r', *(?P<key>[^: ]+) *:', puzzle)
        keys2 = re.findall(r"\(゚Д゚\) *\[[^']+\] *=", puzzle)
        keys = sorted(set(keys1 + keys2))
        totVars = vars + keys
        for k in range(len(vars)):
            puzzle = puzzle.replace(vars[k], varTags[k])
        for k in range(len(keys)):
            puzzle = puzzle.replace(keys[k], varTags[-k - 1])

    #     puzzle = puzzle.replace('\xef\xbe\x89'.decode('utf-8'), '').replace(' ','')
        puzzle = re.sub(r'[ \x80-\xff]', '', puzzle)
        pat_dicId = r'\(([A-Z])\)={'
        m = re.search(pat_dicId, puzzle)
        assert m, 'No se encontro Id del diccionario'
        dicId = m.group(1)
        #     pat_obj = r"\(\(%s\)\+\\'_\\'\)" % dicId
        dic_pat1 = r"\(\(%s\)\+\'_\'\)" % dicId
        dic_pat2 = r"\(%s\+([^+)]+)\)" % dicId
        dic_pat3 = r"\(%s\)\.(.+?)\b" % dicId
        dic_pat4 = r"(?<=[{,])([^: ]+)(?=:)"

        puzzle = re.sub(dic_pat1, "'[object object]_'", puzzle)
        puzzle = re.sub(dic_pat2,
                        lambda x: "('[object object]'+str(%s))" % x.group(1),
                        puzzle)
        puzzle = re.sub(dic_pat3, lambda x: "(%s)['%s']" % (dicId, x.group(1)),
                        puzzle)
        puzzle = re.sub(dic_pat4, lambda x: "'%s'" % x.group(1), puzzle)

        pat_str1 = r"\((\(.+?\)|[A-Z])\+\'_\'\)"
        pat_str2 = r"\([^()]+\)\[[A-Z]\]\[[A-Z]\]"
        puzzle = re.sub(pat_str1, lambda x: "(str(%s)+'_')" % x.group(1),
                        puzzle)
        puzzle = re.sub(pat_str2, "'function'", puzzle)

        codeGlb = {}
        code = puzzle.split(';')
        code.pop()
        code[0] = code[0][:2] + "'undefined'"
        #         for k, linea in enumerate(code[:-1]):
        #             try:
        #                 exec(linea, codeGlb)
        #             except:
        #                 print 'Linea %s con errores ' % k, linea
        #                 code[k] = linea.split('=')[0] + '=' + "'\\\\'"
        #                 print 'Se corrige como ', code[k]
        #                 exec(code[k], codeGlb)

        linea = code[-1]
        linea = re.sub(r"\(([A-Z]+)\)", lambda x: x.group(1), linea)
        linea = re.sub(r"\([oc]\^_\^o\)",
                       lambda x: "%s" % eval(x.group(), codeGlb), linea)
        while re.search(r"\([^)\]'\[(]+\)", linea):
            linea = re.sub(r"\([^)\]'\[(]+\)",
                           lambda x: "%s" % eval(x.group(), codeGlb), linea)
        linea = re.sub(r"[A-Z](?=[^\]\[])",
                       lambda x: "%s" % eval(x.group(), codeGlb), linea)
        linea = re.sub(r"E\[[\'_A-Z]+\]",
                       lambda x: "%s" % eval(x.group(), codeGlb), linea)
        linea = linea.replace('+', '')
        linea = linea.decode('unicode-escape')
        m = re.search(r'http.+?true', linea)
        urlStr = '%s|%s' % (m.group(), encodeHeaders)
        return urlStr
    if formAttr.get('method', 'POST').upper() != 'POST':
        otherOptions += ' --get'
        pass
    datafrm = '--data-urlencode "%s=%s"'
    if formAttr.get('enctype', '').lower() == 'multipart/form-data':
        datafrm = '--form "%s=%s"'
        pass
    postData = ' '.join(datafrm % (item[0], item[1].encode('utf-8'))
                        for item in formFields)
    return 'curl "{0}" {1} {2} --compressed'.format(baseUrlStr, postData,
                                                    otherOptions)


if __name__ == '__main__':
    baseUrl = 'https://lastpass.com/?ac=1&lpnorefresh=1'
    content = basicFunc.openUrl(baseUrl)[1]

    Root = tk.Tk()
    form_xml = getFormXmlStr(content)
    print(form_xml)
    browser = AppSettingDialog(Root,
                               form_xml,
                               isFile=False,
                               settings={},
                               title='Form Detector In Develovment',
                               dheight=600,
                               dwidth=800)
    print('***Result***')
    pprint.pprint(browser.result)
    print('***AllSettings***')
    pprint.pprint(browser.allSettings)
示例#27
0
 def getUrlContent(self):
     if self._content is None:
         url, content = openUrl(self.classUrl)
         self._content = content
     return self._content