Browse Source

增加日志

zhangliang 4 days ago
parent
commit
92bdfe28ef
1 changed files with 4 additions and 0 deletions
  1. 4 0
      utils/dy_ks_get_url.py

+ 4 - 0
utils/dy_ks_get_url.py

@@ -41,6 +41,7 @@ class Dy_KS:
                                       'Chrome/127.0.0.0 Safari/537.36',
                     }
                     response = requests.request(url=url, method='GET', headers=headers, allow_redirects=False, timeout=30)
+                    logger.info(f"请求{url}响应:{response}")
                     location = response.headers.get('Location', None)
                     match = re.search(r'/video/(\d+)/?', location.split('?')[0] if location else url)
                     if match:
@@ -59,6 +60,7 @@ class Dy_KS:
                 }
 
                 response = requests.request("POST", url, headers=headers, data=payload, timeout= 60)
+                logger.info(f"请求{url}响应:{response.json()}")
                 response = response.json()
                 code = response["code"]
                 if code == 0:
@@ -88,6 +90,7 @@ class Dy_KS:
                               'Chrome/127.0.0.0 Safari/537.36',
             }
             response = requests.request(url=url, method='GET', headers=headers, allow_redirects=False, timeout= 30)
+            logger.info(f"请求{url}响应:{response}")
             location = response.headers.get('Location', None)
             if location == "https://kuaishou.com/":
                 return "作品不存在", None, None
@@ -113,6 +116,7 @@ class Dy_KS:
             }
             time.sleep(random.uniform(10, 50))
             response = requests.request("POST", url, headers=headers, data=payload, timeout= 30)
+            logger.info(f"请求{url}响应:{response.json()}")
             response = response.json()
             code = response["code"]
             if code == 0: