Exemplo n.º 1
0
def getSource(url, fmt, ref):
    src, cookies = youtubedl.extractURL(url, fmt)
    src, extra_cookies = getRedirectLink(src)
    src = removeHashTag(src)
    if extra_cookies:
        cookies = extra_cookies
    return xurl.xurlObj(src, cookies=cookies, ref=url)
Exemplo n.º 2
0
def runSMP(url, ref):
    if youtubedl.checkURL(url):
        url = youtubedl.extractURL(url)
    if not url:
        print('[xplay] invalid url')
        return 0
    subprocess.Popen('%s \'%s\'' %(xdef.smp, url), shell=True)
    return 0
Exemplo n.º 3
0
def getSource(url, fmt, ref):
    local_json = youtubedl.extractURL(url, dontParseJson=True)
    local_m3u8 = re.sub('.json', '.m3u8', local_json)
    m = re.search(r'"manifest_url": "([^"]*)"', xurl.readLocal(local_json))
    if m:
        manifest_url = m.group(1)
        xurl.load(manifest_url, local=local_m3u8)
        return local_m3u8
    return None
Exemplo n.º 4
0
def runOMXP(url, ref):
    if youtubedl.checkURL(url):
        url = youtubedl.extractURL(url)
    if not url:
        print('[xplay] invalid url')
        return 0
    if checkProcessRunning('omxplayer.bin'):
        omxp.setAct('stop', None)
    if re.search(r'.m3u($)', url):
        url = xurl.readLocal(url).rstrip()
        print('\n[omxp][play] '+url)
    p = subprocess.Popen('%s \'%s\' 2>&1 | tee %s' %(xdef.omxp, url, xdef.log), shell=True)
    if p:
        p.communicate()
    return 0
Exemplo n.º 5
0
def getSource(url, fmt, ref):
    for m in mods:
        if re.search(m.VALID_URL, url):
            ret = m.getSource(url, fmt, ref)
            if type(ret) is xurl.xurlObj:
                return ret.url, ret.cookies, ret.ref
            return ret, None, None

    # apply youtubedl if no module matched
    src, cookies = youtubedl.extractURL(url, fmt, ref=ref)
    ref = url

    if not src:
        src = getIframeSrc(url)

    return src, cookies, ref
Exemplo n.º 6
0
def runMPV(url, ref):

    p = None
    xargs = ''

    if url[0] == '/':
        xargs = xdef.mpv_ytdl

    if ref != 'x' and youtubedl.checkURL(url):
        url = youtubedl.extractURL(url)
        xargs = xdef.mpv_ytdl

    if not url:
        print('[xplay] invalid url')
        return 0

    if not checkProcessRunning('mpv'):

        xargs = xargs + ' --user-agent=\'%s\'' %(xdef.ua)
        xargs = xargs + ' --referrer=\'%s\'' %(ref)
        xargs = xargs + ' --input-file=\'%s\'' %(xdef.fifo)

        p = subprocess.Popen('%s %s \'%s\'' %(xdef.mpv, xargs, url), shell=True)

    else:
        os.system('echo loadfile \"%s\" > %s' %(url, xdef.fifo))
        os.system('echo sub-remove > %s' %(xdef.fifo))

    sub = youtubedl.extractSUB(ref)
    if sub:
        os.system('echo sub-add \"%s\" select > %s' %(sub, xdef.fifo))

    if p:
        p.communicate()

    return 0
Exemplo n.º 7
0
def runDBG(url, ref):
    if youtubedl.checkURL(url):
        youtubedl.extractURL(url)
    youtubedl.extractSUB(url)
    return 0