mirror of
https://github.com/soimort/you-get.git
synced 2025-02-03 00:33:58 +03:00
add support for AcFun
This commit is contained in:
parent
b75bfca149
commit
0fad3d9673
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from .acfun import *
|
||||||
from .cntv import *
|
from .cntv import *
|
||||||
from .iqiyi import *
|
from .iqiyi import *
|
||||||
from .ku6 import *
|
from .ku6 import *
|
||||||
|
60
you_get/downloader/acfun.py
Normal file
60
you_get/downloader/acfun.py
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
__all__ = ['acfun_download']
|
||||||
|
|
||||||
|
from ..common import *
|
||||||
|
|
||||||
|
from .sina import sina_download_by_id
|
||||||
|
from .tudou import tudou_download_by_iid
|
||||||
|
from .youku import youku_download_by_id
|
||||||
|
|
||||||
|
import json, re
|
||||||
|
|
||||||
|
def get_srt_json(id):
|
||||||
|
url = 'http://comment.acfun.tv/%s.json' % id
|
||||||
|
return get_html(url)
|
||||||
|
|
||||||
|
def qq_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False):
|
||||||
|
url = 'http://vsrc.store.qq.com/%s.flv' % id
|
||||||
|
assert title
|
||||||
|
_, _, size = url_info(url)
|
||||||
|
|
||||||
|
print_info(site_info, title, 'flv', size)
|
||||||
|
if not info_only:
|
||||||
|
download_urls([url], title, 'flv', size, output_dir = output_dir, merge = merge)
|
||||||
|
|
||||||
|
def acfun_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False):
|
||||||
|
info = json.loads(get_html('http://www.acfun.tv/api/getVideoByID.aspx?vid=' + id))
|
||||||
|
t = info['vtype']
|
||||||
|
vid = info['vid']
|
||||||
|
if t == 'sina':
|
||||||
|
sina_download_by_id(vid, title, output_dir = output_dir, merge = merge, info_only = info_only)
|
||||||
|
elif t == 'youku':
|
||||||
|
youku_download_by_id(vid, title, output_dir = output_dir, merge = merge, info_only = info_only)
|
||||||
|
elif t == 'tudou':
|
||||||
|
tudou_download_by_iid(vid, title, output_dir = output_dir, merge = merge, info_only = info_only)
|
||||||
|
elif t == 'qq':
|
||||||
|
qq_download_by_id(vid, title, output_dir = output_dir, merge = merge, info_only = info_only)
|
||||||
|
else:
|
||||||
|
raise NotImplementedError(t)
|
||||||
|
|
||||||
|
#srt = get_srt_json(vid)
|
||||||
|
#with open(title + '.json', 'w') as x:
|
||||||
|
# x.write(srt)
|
||||||
|
|
||||||
|
def acfun_download(url, output_dir = '.', merge = True, info_only = False):
|
||||||
|
assert re.match(r'http://www.acfun.tv/v/ac(\d+)', url)
|
||||||
|
html = get_html(url)
|
||||||
|
|
||||||
|
title = r1(r'<span id="title-article" class="title"[^<>]*>([^<>]+)</span>', html)
|
||||||
|
assert title
|
||||||
|
title = unescape_html(title)
|
||||||
|
title = escape_file_path(title)
|
||||||
|
title = title.replace(' - AcFun.tv', '')
|
||||||
|
|
||||||
|
id = r1(r"flashvars = {'id':'(\d+)'", html)
|
||||||
|
acfun_download_by_id(id, title, output_dir = output_dir, merge = merge, info_only = info_only)
|
||||||
|
|
||||||
|
site_info = "AcFun.tv"
|
||||||
|
download = acfun_download
|
||||||
|
download_playlist = playlist_not_supported('acfun')
|
@ -17,6 +17,7 @@ def url_to_module(url):
|
|||||||
k = r1(r'([^.]+)', domain)
|
k = r1(r'([^.]+)', domain)
|
||||||
downloads = {
|
downloads = {
|
||||||
'56': w56,
|
'56': w56,
|
||||||
|
'acfun': acfun,
|
||||||
'cntv': cntv,
|
'cntv': cntv,
|
||||||
'iask': sina,
|
'iask': sina,
|
||||||
'iqiyi': iqiyi,
|
'iqiyi': iqiyi,
|
||||||
@ -29,7 +30,6 @@ def url_to_module(url):
|
|||||||
'youku': youku,
|
'youku': youku,
|
||||||
'youtube': youtube,
|
'youtube': youtube,
|
||||||
#TODO:
|
#TODO:
|
||||||
# 'acfun': acfun,
|
|
||||||
# 'bilibili': bilibili,
|
# 'bilibili': bilibili,
|
||||||
# 'kankanews': bilibili,
|
# 'kankanews': bilibili,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user