From 154b22930b356630a34c860b045cdbcd16cd85fc Mon Sep 17 00:00:00 2001 From: axzxc1236 Date: Sun, 18 Aug 2019 08:10:15 +0800 Subject: [PATCH] Pick best video quality for ixigua --- src/you_get/extractors/ixigua.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/you_get/extractors/ixigua.py b/src/you_get/extractors/ixigua.py index 164161cc..11db08ac 100644 --- a/src/you_get/extractors/ixigua.py +++ b/src/you_get/extractors/ixigua.py @@ -103,10 +103,11 @@ def ixigua_download(url, output_dir='.', merge=True, info_only=False, **kwargs): log.e("Get video info from {} error: The server returns JSON value" " without data.video_list.video_1 or data.video_list.video_1 is empty".format(video_info_url)) return - size = int(video_info["data"]["video_list"]["video_1"]["size"]) + bestQualityVideo = list(video_info["data"]["video_list"].keys())[-1] #There is not only video_1, there might be video_2 + size = int(video_info["data"]["video_list"][bestQualityVideo]["size"]) print_info(site_info=site_info, title=title, type="mp4", size=size) # 该网站只有mp4类型文件 if not info_only: - video_url = base64.b64decode(video_info["data"]["video_list"]["video_1"]["main_url"].encode("utf-8")) + video_url = base64.b64decode(video_info["data"]["video_list"][bestQualityVideo]["main_url"].encode("utf-8")) download_urls([video_url.decode("utf-8")], title, "mp4", size, output_dir, merge=merge, headers=headers, **kwargs)