예제 #1
0
def acfun_download_by_id(id, title):
    info = json.loads(get_html("http://www.acfun.tv/api/getVideoByID.aspx?vid=" + id))
    t = info["vtype"]
    vid = info["vid"]
    if t == "sina":
        iask_download_by_id(vid, title)
    elif t == "youku":
        youku_download_by_id(vid, title)
    elif t == "tudou":
        tudou_download_by_iid(vid, title)
    elif t == "qq":
        qq_download_by_id(vid, title)
    else:
        raise NotImplementedError(t)

    srt = get_srt_json(vid)
    with open(title + ".json", "w") as x:
        x.write(srt)
예제 #2
0
def acfun_download_by_id(id, title, merge=True):
	info = json.loads(get_html('http://www.acfun.tv/api/getVideoByID.aspx?vid=' + id))
	t = info['vtype']
	vid = info['vid']
	if t == 'sina':
		iask_download_by_id(vid, title, merge=merge)
	elif t == 'youku':
		youku_download_by_id(vid, title, merge=merge)
	elif t == 'tudou':
		tudou_download_by_iid(vid, title, merge=merge)
	elif t == 'qq':
		qq_download_by_id(vid, title, merge=merge)
	else:
		raise NotImplementedError(t)

	srt = get_srt_json(vid)
	with open(title + '.json', 'w') as x:
		x.write(srt)
예제 #3
0
def acfun_download_by_id(id, title, merge=True):
    info = json.loads(
        get_html('http://www.acfun.tv/api/getVideoByID.aspx?vid=' + id))
    t = info['vtype']
    vid = info['vid']
    if t == 'sina':
        iask_download_by_id(vid, title, merge=merge)
    elif t == 'youku':
        youku_download_by_id(vid, title, merge=merge)
    elif t == 'tudou':
        tudou_download_by_iid(vid, title, merge=merge)
    elif t == 'qq':
        qq_download_by_id(vid, title, merge=merge)
    else:
        raise NotImplementedError(t)

    srt = get_srt_json(vid)
    with open(title + '.json', 'w') as x:
        x.write(srt)
예제 #4
0
def acfun_download(url):
	assert re.match(r'http://www.acfun.tv/v/ac(\d+)', url)
	html = get_html(url).decode('gbk')

	title = r1(r'<title>([^<>]+)</title>', html)
	title = unescape_html(title)
	title = escape_file_path(title)
	title = title.replace(' - AcFun.tv', '')

	flashvars = r1(r'flashvars="([^"]+)"', html)

	t, id = flashvars.split('&amp;id=')
	if t == 'type=video':
		iask_download_by_id(id, title)
	elif t == 'type2=youku':
		youku_download_by_id(id, title)
	elif t == 'type2=tudou':
		tudou_download_by_iid(id, title)
	else:
		raise NotImplementedError(flashvars)

	json = get_srt_json(id)
	with open(title + '.json', 'w') as x:
		x.write(json)