From 154b22930b356630a34c860b045cdbcd16cd85fc Mon Sep 17 00:00:00 2001 From: axzxc1236 Date: Sun, 18 Aug 2019 08:10:15 +0800 Subject: [PATCH 1/2] 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) From 65293201f3bbd599dc5626db630d68e8971a10fa Mon Sep 17 00:00:00 2001 From: axzxc1236 Date: Sun, 18 Aug 2019 08:45:24 +0800 Subject: [PATCH 2/2] Fix wrong video title for ixigua --- src/you_get/extractors/ixigua.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/you_get/extractors/ixigua.py b/src/you_get/extractors/ixigua.py index 11db08ac..6ac252ef 100644 --- a/src/you_get/extractors/ixigua.py +++ b/src/you_get/extractors/ixigua.py @@ -82,7 +82,7 @@ def ixigua_download(url, output_dir='.', merge=True, info_only=False, **kwargs): # example url: https://www.ixigua.com/i6631065141750268420/#mid=63024814422 html = get_html(url, faker=True) video_id = match1(html, r"\"vid\":\"([^\"]+)") - title = match1(html, r"\"title\":\"(\S+?)\",") + title = match1(html, r"\"player__videoTitle\">

(.*)<\/h1><\/div>") if not video_id: log.e("video_id not found, url:{}".format(url)) return