This commit is contained in:
wang1365 2018-01-03 17:09:46 +08:00
parent cd77aad47c
commit cb2e31080b
2 changed files with 21 additions and 0 deletions

View File

@ -131,6 +131,20 @@ def netease_download(url, output_dir = '.', merge = True, info_only = False, **k
url = get_location(url) url = get_location(url)
if "music.163.com" in url: if "music.163.com" in url:
netease_cloud_music_download(url, output_dir, merge, info_only, **kwargs) netease_cloud_music_download(url, output_dir, merge, info_only, **kwargs)
elif "v.ent.163.com/video" in url:
# Parse and download video pages like:
# http://v.ent.163.com/video/2017/12/9/V/VD5BG8P9V.html
html = get_decoded_html(url)
title = r1(r'<h1[^>]*?><span[^>]*?>([^<]*?)</span></h1>', html)
title = title.strip() if title else ''
video_url = r1(r'"url_mp4": "([^"]*?)"', html)
if video_url:
_, ext, size = url_info(video_url)
print_info(site_info, title, ext, size)
if not info_only:
download_urls([video_url], title, ext, size, output_dir=output_dir, merge=merge)
else: else:
html = get_decoded_html(url) html = get_decoded_html(url)

View File

@ -9,6 +9,7 @@ from you_get.extractors import (
yixia, yixia,
bilibili, bilibili,
douyin, douyin,
netease,
) )
@ -53,6 +54,12 @@ class YouGetTests(unittest.TestCase):
info_only=True info_only=True
) )
def test_netease(self):
netease.download(
'http://v.ent.163.com/video/2017/12/9/V/VD5BG8P9V.html',
info_only=True
)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()