Create login.py
Browse files
login.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# login.py
|
| 2 |
+
import undetected_chromedriver as uc
|
| 3 |
+
import json
|
| 4 |
+
import time
|
| 5 |
+
|
| 6 |
+
TARGET_URL = "https://hailuoai.video/create"
|
| 7 |
+
COOKIES_FILE = "cookies.json"
|
| 8 |
+
|
| 9 |
+
def main():
|
| 10 |
+
# Khởi Chrome (có cửa sổ để bạn login thủ công)
|
| 11 |
+
driver = uc.Chrome()
|
| 12 |
+
driver.get(TARGET_URL)
|
| 13 |
+
print("👉 Vui lòng login vào hailuoai.video trong cửa sổ này.")
|
| 14 |
+
input("⏳ Sau khi login xong, nhấn Enter ở đây để lưu cookies…")
|
| 15 |
+
cookies = driver.get_cookies()
|
| 16 |
+
with open(COOKIES_FILE, 'w', encoding='utf-8') as f:
|
| 17 |
+
json.dump(cookies, f, ensure_ascii=False, indent=2)
|
| 18 |
+
print(f"✅ Đã lưu cookies vào {COOKIES_FILE}")
|
| 19 |
+
driver.quit()
|
| 20 |
+
|
| 21 |
+
if __name__ == "__main__":
|
| 22 |
+
main()
|