mirror of
https://github.com/soimort/you-get.git
synced 2025-01-23 21:45:02 +03:00
Merge branch 'develop' of https://github.com/lxfly2000/you-get into lxfly2000-develop
This commit is contained in:
commit
47451e913e
@ -124,9 +124,8 @@ def acfun_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
|||||||
|
|
||||||
m3u8_url = json_data.get('currentVideoInfo')['playInfos'][0]['playUrls'][0]
|
m3u8_url = json_data.get('currentVideoInfo')['playInfos'][0]['playUrls'][0]
|
||||||
|
|
||||||
# FIXME: bangumi
|
|
||||||
elif re.match("https?://[^\.]*\.*acfun\.[^\.]+/bangumi/ab(\d+)", url):
|
elif re.match("https?://[^\.]*\.*acfun\.[^\.]+/bangumi/ab(\d+)", url):
|
||||||
html = get_content(url)
|
html = get_content(url, headers=fake_headers)
|
||||||
tag_script = match1(html, r'<script>window\.pageInfo([^<]+)</script>')
|
tag_script = match1(html, r'<script>window\.pageInfo([^<]+)</script>')
|
||||||
json_text = tag_script[tag_script.find('{') : tag_script.find('};') + 1]
|
json_text = tag_script[tag_script.find('{') : tag_script.find('};') + 1]
|
||||||
json_data = json.loads(json_text)
|
json_data = json.loads(json_text)
|
||||||
@ -134,6 +133,19 @@ def acfun_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
|||||||
vid = str(json_data['videoId'])
|
vid = str(json_data['videoId'])
|
||||||
up = "acfun"
|
up = "acfun"
|
||||||
|
|
||||||
|
play_info = get_content("https://www.acfun.cn/rest/pc-direct/play/playInfo/m3u8Auto?videoId=" + vid, headers=fake_headers)
|
||||||
|
play_url = json.loads(play_info)['playInfo']['streams'][0]['playUrls'][0]
|
||||||
|
m3u8_all_qualities_file = get_content(play_url)
|
||||||
|
m3u8_all_qualities_lines = m3u8_all_qualities_file.split('#EXT-X-STREAM-INF:')[1:]
|
||||||
|
highest_quality_line = m3u8_all_qualities_lines[0]
|
||||||
|
for line in m3u8_all_qualities_lines:
|
||||||
|
bandwith = int(match1(line, r'BANDWIDTH=(\d+)'))
|
||||||
|
if bandwith > int(match1(highest_quality_line, r'BANDWIDTH=(\d+)')):
|
||||||
|
highest_quality_line = line
|
||||||
|
#TODO: 应由用户指定清晰度
|
||||||
|
m3u8_url = match1(highest_quality_line, r'\n([^#\n]+)$')
|
||||||
|
m3u8_url = play_url[:play_url.rfind("/")+1] + m3u8_url
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise NotImplemented
|
raise NotImplemented
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user