From dccde20a194c47c0273d857681c4c142226cdb02 Mon Sep 17 00:00:00 2001 From: yezian Date: Tue, 13 Aug 2024 15:49:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=BF=AB=E6=89=8B=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E8=B4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qushuiyin.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/qushuiyin.py b/qushuiyin.py index 8181896..f8d1ed1 100644 --- a/qushuiyin.py +++ b/qushuiyin.py @@ -251,6 +251,32 @@ class Video: response = requests.post(url, headers=headers, data=post_data) json_data = response.json() + if len(json_data["photo"]["mainMvUrls"]) == 0: + cdn = json_data["photo"]["ext_params"]["atlas"]["cdn"][0] + origin_image_urls = [ + ("https://" + cdn + image) + for image in json_data["photo"]["ext_params"]["atlas"]["list"] + ] + image_urls = [endecode_and_proxy_url(url) for url in origin_image_urls] + + result = { + "code": 200, + "msg": "解析成功", + "data": { + "avatar": endecode_and_proxy_url(json_data["photo"]["headUrl"]), + "author": json_data["photo"]["userName"], + "time": json_data["photo"]["timestamp"], + "title": json_data["photo"]["caption"], + "cover": endecode_and_proxy_url( + json_data["photo"]["coverUrls"][0]["url"] + ), + "origin_cover": json_data["photo"]["coverUrls"][0]["url"], + "image_urls": image_urls, + "origin_image_urls": origin_image_urls, + }, + } + return result + video_url = json_data["photo"]["mainMvUrls"][0]["url"] if video_url: result = {