Merge pull request #139 from andaoai/fix/cookies-directory-not-found
Browse files- myUtils/login.py +16 -4
myUtils/login.py
CHANGED
|
@@ -50,7 +50,10 @@ async def douyin_cookie_gen(id,status_queue):
|
|
| 50 |
return None
|
| 51 |
uuid_v1 = uuid.uuid1()
|
| 52 |
print(f"UUID v1: {uuid_v1}")
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
| 54 |
result = await check_cookie(3, f"{uuid_v1}.json")
|
| 55 |
if not result:
|
| 56 |
status_queue.put("500")
|
|
@@ -125,7 +128,10 @@ async def get_tencent_cookie(id,status_queue):
|
|
| 125 |
return None
|
| 126 |
uuid_v1 = uuid.uuid1()
|
| 127 |
print(f"UUID v1: {uuid_v1}")
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
| 129 |
result = await check_cookie(2,f"{uuid_v1}.json")
|
| 130 |
if not result:
|
| 131 |
status_queue.put("500")
|
|
@@ -196,7 +202,10 @@ async def get_ks_cookie(id,status_queue):
|
|
| 196 |
return None
|
| 197 |
uuid_v1 = uuid.uuid1()
|
| 198 |
print(f"UUID v1: {uuid_v1}")
|
| 199 |
-
|
|
|
|
|
|
|
|
|
|
| 200 |
result = await check_cookie(4, f"{uuid_v1}.json")
|
| 201 |
if not result:
|
| 202 |
status_queue.put("500")
|
|
@@ -267,7 +276,10 @@ async def xiaohongshu_cookie_gen(id,status_queue):
|
|
| 267 |
return None
|
| 268 |
uuid_v1 = uuid.uuid1()
|
| 269 |
print(f"UUID v1: {uuid_v1}")
|
| 270 |
-
|
|
|
|
|
|
|
|
|
|
| 271 |
result = await check_cookie(1, f"{uuid_v1}.json")
|
| 272 |
if not result:
|
| 273 |
status_queue.put("500")
|
|
|
|
| 50 |
return None
|
| 51 |
uuid_v1 = uuid.uuid1()
|
| 52 |
print(f"UUID v1: {uuid_v1}")
|
| 53 |
+
# 确保cookiesFile目录存在
|
| 54 |
+
cookies_dir = Path(BASE_DIR / "cookiesFile")
|
| 55 |
+
cookies_dir.mkdir(exist_ok=True)
|
| 56 |
+
await context.storage_state(path=cookies_dir / f"{uuid_v1}.json")
|
| 57 |
result = await check_cookie(3, f"{uuid_v1}.json")
|
| 58 |
if not result:
|
| 59 |
status_queue.put("500")
|
|
|
|
| 128 |
return None
|
| 129 |
uuid_v1 = uuid.uuid1()
|
| 130 |
print(f"UUID v1: {uuid_v1}")
|
| 131 |
+
# 确保cookiesFile目录存在
|
| 132 |
+
cookies_dir = Path(BASE_DIR / "cookiesFile")
|
| 133 |
+
cookies_dir.mkdir(exist_ok=True)
|
| 134 |
+
await context.storage_state(path=cookies_dir / f"{uuid_v1}.json")
|
| 135 |
result = await check_cookie(2,f"{uuid_v1}.json")
|
| 136 |
if not result:
|
| 137 |
status_queue.put("500")
|
|
|
|
| 202 |
return None
|
| 203 |
uuid_v1 = uuid.uuid1()
|
| 204 |
print(f"UUID v1: {uuid_v1}")
|
| 205 |
+
# 确保cookiesFile目录存在
|
| 206 |
+
cookies_dir = Path(BASE_DIR / "cookiesFile")
|
| 207 |
+
cookies_dir.mkdir(exist_ok=True)
|
| 208 |
+
await context.storage_state(path=cookies_dir / f"{uuid_v1}.json")
|
| 209 |
result = await check_cookie(4, f"{uuid_v1}.json")
|
| 210 |
if not result:
|
| 211 |
status_queue.put("500")
|
|
|
|
| 276 |
return None
|
| 277 |
uuid_v1 = uuid.uuid1()
|
| 278 |
print(f"UUID v1: {uuid_v1}")
|
| 279 |
+
# 确保cookiesFile目录存在
|
| 280 |
+
cookies_dir = Path(BASE_DIR / "cookiesFile")
|
| 281 |
+
cookies_dir.mkdir(exist_ok=True)
|
| 282 |
+
await context.storage_state(path=cookies_dir / f"{uuid_v1}.json")
|
| 283 |
result = await check_cookie(1, f"{uuid_v1}.json")
|
| 284 |
if not result:
|
| 285 |
status_queue.put("500")
|