|
@@ -96,23 +96,22 @@ class CarryViode:
|
|
|
headers = {
|
|
|
'Content-Type': 'application/json'
|
|
|
}
|
|
|
- for i in range(3):
|
|
|
- response = requests.request("POST", url, headers=headers, data=payload, timeout= 30)
|
|
|
- response = response.json()
|
|
|
- code = response["code"]
|
|
|
- if code == 0:
|
|
|
- data = response["data"]["data"]
|
|
|
- content_type = data['content_type']
|
|
|
- if content_type == 'note':
|
|
|
- return "note","note"
|
|
|
- video_url = data["video_url_list"][0]["video_url"]
|
|
|
- original_title = data["title"]
|
|
|
- return video_url, original_title, video_id
|
|
|
- elif code == 27006:
|
|
|
- if "作品不存在" in response['msg']:
|
|
|
- return "作品不存在", None, None
|
|
|
- time.sleep(3)
|
|
|
- return None,None,None
|
|
|
+ time.sleep(random.uniform(10, 50))
|
|
|
+ response = requests.request("POST", url, headers=headers, data=payload, timeout= 30)
|
|
|
+ response = response.json()
|
|
|
+ code = response["code"]
|
|
|
+ if code == 0:
|
|
|
+ data = response["data"]["data"]
|
|
|
+ content_type = data['content_type']
|
|
|
+ if content_type == 'note':
|
|
|
+ return "note","note"
|
|
|
+ video_url = data["video_url_list"][0]["video_url"]
|
|
|
+ original_title = data["title"]
|
|
|
+ return video_url, original_title, video_id
|
|
|
+ elif code == 27006:
|
|
|
+ if "作品不存在" in response['msg']:
|
|
|
+ return "作品不存在", None, None
|
|
|
+ time.sleep(3)
|
|
|
except Exception as e:
|
|
|
logger.error(f"[+] 快手{url}获取视频链接失败,失败信息{e}")
|
|
|
return None, None,None
|