支持快手图片贴
This commit is contained in:
parent
4cad0f65e2
commit
dccde20a19
26
qushuiyin.py
26
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 = {
|
||||
|
|
Loading…
Reference in New Issue