mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-06 02:30:41 -08:00
Read cookies from config in Gemini
Fixes for OpenaiChat Provider
This commit is contained in:
parent
2054acce0a
commit
af204c31cb
5 changed files with 14 additions and 9 deletions
|
|
@ -66,6 +66,8 @@ class Gemini(AsyncGeneratorProvider):
|
|||
prompt = format_prompt(messages)
|
||||
|
||||
if not cookies:
|
||||
cookies = get_cookies(".google.com", False, True)
|
||||
if "__Secure-1PSID" not in cookies or "__Secure-1PSIDCC" not in cookies:
|
||||
driver = None
|
||||
try:
|
||||
driver = get_browser(proxy=proxy)
|
||||
|
|
@ -88,8 +90,6 @@ class Gemini(AsyncGeneratorProvider):
|
|||
if driver:
|
||||
driver.close()
|
||||
|
||||
if not cookies:
|
||||
cookies = get_cookies(".google.com", False)
|
||||
if "__Secure-1PSID" not in cookies:
|
||||
raise MissingAuthError('Missing "__Secure-1PSID" cookie')
|
||||
|
||||
|
|
@ -101,6 +101,7 @@ class Gemini(AsyncGeneratorProvider):
|
|||
) as session:
|
||||
async with session.get(cls.url, proxy=proxy) as response:
|
||||
text = await response.text()
|
||||
open("test.html", "w").write(text)
|
||||
match = re.search(r'SNlM0e\":\"(.*?)\"', text)
|
||||
if match:
|
||||
snlm0e = match.group(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue