示例#1
0
def parse_danmaku_cb(page, data):
    options, result, url = data
    match = cid_re.search(page)
    if match:
        danmaku = 'http://comment.bilibili.com/%s.xml' % match.group(1)
        if len(result) == 0:
            moonplayer.use_fallback_parser(url, options & moonplayer.OPT_DOWNLOAD, danmaku)
        elif options & moonplayer.OPT_DOWNLOAD:
            if len(result) == 2:
                moonplayer.download_with_danmaku(result, danmaku)
            else:
                moonplayer.download_with_danmaku(result, danmaku, result[0])
        else:
            moonplayer.play(result, danmaku)
    else:
        moonplayer.warn('无法获取弹幕!')
        if len(result) == 0:
            moonplayer.use_fallback_parser(url, options & moonplayer.OPT_DOWNLOAD)
        elif options & moonplayer.OPT_DOWNLOAD:
            if len(result) == 2:
                moonplayer.download(result)
            else:
                moonplayer.download(result, result[0])
        else:
            moonplayer.play(result)
示例#2
0
def parse_danmaku_cb(page, data):
    options, result, url = data
    # Cannot get the video name from flvcd.com page correctly
    match = name_re.search(page)
    if match:
        name = match.group(1) + ".flv"
    else:
        name = result[0]
        
    match = cid_re.search(page)
    if match:
        danmaku = 'http://danmu.aixifan.com/V2/' + match.group(1)
        if len(result) == 0:
            moonplayer.use_fallback_parser(url, options & moonplayer.OPT_DOWNLOAD, danmaku)
        elif options & moonplayer.OPT_DOWNLOAD:
            if len(result) == 2:
                result[0] = name
                moonplayer.download_with_danmaku(result, danmaku)
            else:
                moonplayer.download_with_danmaku(result, danmaku, name)
        else:
            moonplayer.play(result, danmaku)
    else:
        moonplayer.warn('无法获取弹幕!')
        if len(result) == 0:
            moonplayer.use_fallback_parser(url, options & moonplayer.OPT_DOWNLOAD)
        if options & moonplayer.OPT_DOWNLOAD:
            if len(result) == 2:
                result[0] = name
                moonplayer.download(result)
            else:
                moonplayer.download(result, name)
        else:
            moonplayer.play(result)
示例#3
0
def parse_danmaku_cb(page, data):
    options, result, url = data
    # Cannot get the video name from flvcd.com page correctly
    match = name_re.search(page)
    if match:
        name = match.group(1) + ".flv"
    else:
        name = result[0]
        
    match = cid_re.search(page)
    if match:
        danmaku = 'http://danmu.aixifan.com/V2/' + match.group(1)
        if len(result) == 0:
            moonplayer.use_fallback_parser(url, options & moonplayer.OPT_DOWNLOAD, danmaku)
        elif options & moonplayer.OPT_DOWNLOAD:
            if len(result) == 2:
                result[0] = name
                moonplayer.download_with_danmaku(result, danmaku)
            else:
                moonplayer.download_with_danmaku(result, danmaku, name)
        else:
            moonplayer.play(result, danmaku)
    else:
        moonplayer.warn('无法获取弹幕!')
        if len(result) == 0:
            moonplayer.use_fallback_parser(url, options & moonplayer.OPT_DOWNLOAD)
        if options & moonplayer.OPT_DOWNLOAD:
            if len(result) == 2:
                result[0] = name
                moonplayer.download(result)
            else:
                moonplayer.download(result, name)
        else:
            moonplayer.play(result)
示例#4
0
def parse_cb(page, data):
    options = data[0]
    url = data[1]
    match = cantonese_re.search(page)
    if match and not '_lang=1' in moonplayer.final_url:
        if moonplayer.question('是否解析为粤语版?'):
            url = match.group(1)
            if not url.startswith('http://'):
                url = 'http://www.flvcd.com/' + url
            url += '&go=1'
            moonplayer.download_page(url, parse_cb, data)
            return
    result = parse_flvcd_page(page, None)
    if len(result) == 0:
        moonplayer.use_fallback_parser(url, options & moonplayer.OPT_DOWNLOAD)
    elif options & moonplayer.OPT_DOWNLOAD:
        if len(result) == 2:
            moonplayer.download(result)
        else:
            moonplayer.download(result, result[0])
    else:
        moonplayer.play(result)
示例#5
0
def parse_cb(page, data):
    options = data[0]
    url = data[1]
    match = cantonese_re.search(page)
    if match and not '_lang=1' in moonplayer.final_url:
        if moonplayer.question('是否解析为粤语版?'):
            url = match.group(1)
            if not url.startswith('http://'):
                url = 'http://www.flvcd.com/' + url
            url += '&go=1'
            moonplayer.get_url(url, parse_cb, data)
            return
    result = parse_flvcd_page(page, None)
    if len(result) == 0:
        moonplayer.use_fallback_parser(url, options & moonplayer.OPT_DOWNLOAD)
    elif options & moonplayer.OPT_DOWNLOAD:
        if len(result) == 2:
            moonplayer.download(result)
        else:
            moonplayer.download(result, result[0])
    else:
        moonplayer.play(result)