..
This commit is contained in:
@@ -15,12 +15,15 @@ os.makedirs(split_directory, exist_ok=True)
|
||||
os.makedirs(translated_directory, exist_ok=True)
|
||||
|
||||
# Pfad zu deinem Chrome Profil (anpassen)
|
||||
chrome_profile_path = "C:\Users\Alzer\AppData\Local\Google\Chrome\User Data\Default"
|
||||
cookie_file = "chrome_cookies.json"
|
||||
chrome_profile_path = "C:/Users/Alzer/AppData/Local/Google/Chrome/User Data/Default/"
|
||||
|
||||
# Deine Chat-URL (ersetzen)
|
||||
chat_url = "https://chatgpt.com/c/68271195-7a84-800d-b66a-7a73edfb121a" # Deine echte Chat-URL hier einfügen
|
||||
|
||||
# Geckodriver-Pfad (anpassen, falls nötig)
|
||||
chromedriver_path = "/Pfad/zu/deinem/chromedriver"
|
||||
chromedriver_path = "C:/Windows/System32/chromedriver.exe"
|
||||
|
||||
cookie_file = "chrome_cookies.json"
|
||||
# Schritt 1: Datei in Einträge aufteilen
|
||||
try:
|
||||
with open(input_file, 'r', encoding='utf-8') as file:
|
||||
@@ -61,23 +64,37 @@ try:
|
||||
|
||||
driver.get("https://chat.openai.com/")
|
||||
|
||||
# Cookies importieren, falls vorhanden
|
||||
# Cookies importieren, falls vorhanden
|
||||
if os.path.exists(cookie_file):
|
||||
with open(cookie_file, "r") as file:
|
||||
cookies = json.load(file)
|
||||
for cookie in cookies:
|
||||
driver.add_cookie(cookie)
|
||||
# Cookie-Domain korrigieren
|
||||
if "domain" in cookie:
|
||||
cookie["domain"] = ".chat.openai.com"
|
||||
try:
|
||||
driver.add_cookie(cookie)
|
||||
except Exception as e:
|
||||
print(f"⚠️ Fehler beim Setzen des Cookies: {e}")
|
||||
print("✅ Cookies importiert.")
|
||||
|
||||
# Seite neu laden, um Cookies zu aktivieren
|
||||
driver.get("https://chat.openai.com/")
|
||||
|
||||
# Cookies speichern (nur beim ersten Mal notwendig)
|
||||
if not os.path.exists(cookie_file):
|
||||
time.sleep(30) # Wartezeit für manuelles Einloggen
|
||||
# Warten, bis du dich eingeloggt hast
|
||||
input("🔑 Bitte logge dich ein und drücke dann Enter, wenn du bereit bist...")
|
||||
with open(cookie_file, "w") as file:
|
||||
json.dump(driver.get_cookies(), file)
|
||||
cookies = driver.get_cookies()
|
||||
for cookie in cookies:
|
||||
if "domain" in cookie:
|
||||
cookie["domain"] = ".chat.openai.com"
|
||||
json.dump(cookies, file)
|
||||
print("✅ Cookies gespeichert.")
|
||||
|
||||
|
||||
# Warten, bis du dich eingeloggt hast
|
||||
input("🔑 Bitte logge dich ein und drücke dann Enter, wenn du bereit bist...")
|
||||
translated_entries = {}
|
||||
for file_name in os.listdir(split_directory):
|
||||
if file_name.endswith(".json"):
|
||||
Reference in New Issue
Block a user