mirror of
https://github.com/soimort/you-get.git
synced 2025-01-23 13:35:16 +03:00
修复acfun的视频下载
This commit is contained in:
parent
61b74e3ce9
commit
b82d1be079
@ -121,8 +121,16 @@ def acfun_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
||||
video_list = json_data.get('videoList')
|
||||
if len(video_list) > 1:
|
||||
title += " - " + [p.get('title') for p in video_list if p.get('id') == vid][0]
|
||||
|
||||
m3u8_url = json_data.get('currentVideoInfo')['playInfos'][0]['playUrls'][0]
|
||||
currentVideoInfo = json_data.get('currentVideoInfo')
|
||||
if 'playInfos' in currentVideoInfo:
|
||||
m3u8_url = currentVideoInfo['playInfos'][0]['playUrls'][0]
|
||||
elif 'ksPlayJson' in currentVideoInfo:
|
||||
ksPlayJson = json.loads( currentVideoInfo['ksPlayJson'] )
|
||||
representation = ksPlayJson.get('adaptationSet').get('representation')
|
||||
reps = []
|
||||
for one in representation:
|
||||
reps.append( (one['width']* one['height'], one['url'], one['backupUrl']) )
|
||||
m3u8_url = max(reps)[1]
|
||||
|
||||
elif re.match("https?://[^\.]*\.*acfun\.[^\.]+/bangumi/ab(\d+)", url):
|
||||
html = get_content(url, headers=fake_headers)
|
||||
|
@ -6,7 +6,8 @@ from you_get.extractors import (
|
||||
imgur,
|
||||
magisto,
|
||||
youtube,
|
||||
missevan
|
||||
missevan,
|
||||
acfun
|
||||
)
|
||||
|
||||
|
||||
@ -38,6 +39,8 @@ class YouGetTests(unittest.TestCase):
|
||||
info_only=True
|
||||
)
|
||||
|
||||
def test_acfun(self):
|
||||
acfun.download('https://www.acfun.cn/v/ac11701912', info_only=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user