diff --git a/qushuiyin.py b/qushuiyin.py index d4bcecb..e27a905 100644 --- a/qushuiyin.py +++ b/qushuiyin.py @@ -16,10 +16,19 @@ def endecode_and_proxy_url(original_url): class Video: def douyin(self, url): # Extract ID from URL - id_match = self.extract_id(url) - if not id_match: + for attempt_1 in range(10): + id_match = self.extract_id(url) + if id_match: + break + else: + time.sleep(0.5) + else: return {"code": 400, "msg": "Unable to parse video ID"} + # id_match = self.extract_id(url) + # if not id_match: + # return {"code": 400, "msg": "Unable to parse video ID"} + video_id = id_match # Construct request headers @@ -46,7 +55,6 @@ class Video: matches = re.search(pattern, response.text, re.DOTALL) if matches: - print(attempt) break else: time.sleep(0.5)