Strvm / meta-ai-api

Llama 3 API (MetaAI Reverse Engineered)
236 stars 43 forks source link

KeyError: "name='xs', domain=None, path=None" #17

Closed RexsyBima closed 2 months ago

RexsyBima commented 4 months ago

when i ran the code from either python or jupiter notebook with these lines

from meta_ai_api import MetaAI

ai = MetaAI(fb_email="someemail", fb_password="somepassword")
response = ai.prompt(message="Whats the weather in San Francisco today? And what is the date?")
print(response)

i got


Traceback (most recent call last):
  File "d:\Python\metaaitest\main.py", line 185, in <module>
    funcGenNews(news)
  File "d:\Python\metaaitest\main.py", line 92, in funcGenNews
    ai = CustomMetaAI()
  File "d:\Python\metaaitest\src\meta_ai.py", line 19, in __init__
    super().__init__(fb_email=fb_email, fb_password=fb_password)
  File "D:\Python\tiktok-content-news-AI\.venv\lib\site-packages\meta_ai_api\main.py", line 50, in __init__
    self.cookies = self.get_cookies()
  File "D:\Python\metaaitest\.venv\lib\site-packages\meta_ai_api\main.py", line 316, in get_cookies
    fb_session = get_fb_session(self.fb_email, self.fb_password)
  File "D:\Python\metaaitest\.venv\lib\site-packages\meta_ai_api\utils.py", line 157, in get_fb_session
    "xs": session.cookies["xs"],
  File "D:\Python\metaaitest\.venv\lib\site-packages\requests\cookies.py", line 334, in __getitem__
    return self._find_no_duplicates(name)
  File "D:\Python\metaaitest\.venv\lib\site-packages\requests\cookies.py", line 413, in _find_no_duplicates
    raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}")
KeyError: "name='xs', domain=None, path=None"

im using vpn to avoid region block, yesterday was fine as butter. idk why it happens

Strvm commented 4 months ago

Hi, are you able to access it with your VPN on a browser?

RexsyBima commented 4 months ago

Yup i can, im using windscribe

Strvm commented 4 months ago

Yup i can, im using windscribe

And could you try without authenticating and tell me what do you get

RexsyBima commented 4 months ago

i got

Exception: Unable to obtain a valid response from Meta AI. Try again later.

just want to make sure, is it still working on your end?

Strvm commented 4 months ago

i got

Exception: Unable to obtain a valid response from Meta AI. Try again later.

just want to make sure, is it still working on your end?

Yep it works fine on my end, without a VPN (I'm in the US)

ai = MetaAI()
print(ai.prompt(message=f"Say this is a test 1"))
{'message': "Test 1 Successful! This is a test indeed! I'm ready to assist you with any questions or tasks you have. What's next?\n", 'sources': [], 'media': []}
RexsyBima commented 4 months ago

im kinda worried it has something to do with my account, i did something in my facebook app which is that i created new fan page profile... ill try to create dummy fresh facebook account just in case, but not now, will try to do it tomorrow

Strvm commented 4 months ago

Not sure it has anything to do with your FB account since it should also work without authenticating

RexsyBima commented 4 months ago

what python version are you using?

Strvm commented 4 months ago

The test was running 3.8, but that shouldn't really matter

RexsyBima commented 4 months ago

so i use some dummy facebook account here, same code, but now i got KeyError instead

Traceback (most recent call last):
  File "d:\Python\meta-ai-api\test.py", line 3, in <module>
    ai = MetaAI(fb_email="xxxx", fb_password="xxxx")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Python\meta-ai-api\.venv\Lib\site-packages\meta_ai_api\main.py", line 50, in __init__
    self.cookies = self.get_cookies()
                   ^^^^^^^^^^^^^^^^^^
  File "D:\Python\meta-ai-api\.venv\Lib\site-packages\meta_ai_api\main.py", line 316, in get_cookies
    fb_session = get_fb_session(self.fb_email, self.fb_password)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Python\meta-ai-api\.venv\Lib\site-packages\meta_ai_api\utils.py", line 210, in get_fb_session
    next_url = response.headers["Location"]
               ~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "D:\Python\meta-ai-api\.venv\Lib\site-packages\requests\structures.py", line 52, in __getitem__
    return self._store[key.lower()][1]
           ~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'location'
RexsyBima commented 4 months ago

Update for this, turns out Meta doesnt allow some dummy account to be using Meta.AI, kinda an L, when i access meta.ai manually using dummya account to login, i got kicked out from login page but there is notification what went wrong, therefore i assume it because i have this dummy account

so i use some dummy facebook account here, same code, but now i got KeyError instead

Traceback (most recent call last):
  File "d:\Python\meta-ai-api\test.py", line 3, in <module>
    ai = MetaAI(fb_email="xxxx", fb_password="xxxx")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Python\meta-ai-api\.venv\Lib\site-packages\meta_ai_api\main.py", line 50, in __init__
    self.cookies = self.get_cookies()
                   ^^^^^^^^^^^^^^^^^^
  File "D:\Python\meta-ai-api\.venv\Lib\site-packages\meta_ai_api\main.py", line 316, in get_cookies
    fb_session = get_fb_session(self.fb_email, self.fb_password)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Python\meta-ai-api\.venv\Lib\site-packages\meta_ai_api\utils.py", line 210, in get_fb_session
    next_url = response.headers["Location"]
               ~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "D:\Python\meta-ai-api\.venv\Lib\site-packages\requests\structures.py", line 52, in __getitem__
    return self._store[key.lower()][1]
           ~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'location'
RexsyBima commented 4 months ago

i got Exception: Unable to obtain a valid response from Meta AI. Try again later. just want to make sure, is it still working on your end?

Yep it works fine on my end, without a VPN (I'm in the US)

ai = MetaAI()
print(ai.prompt(message=f"Say this is a test 1"))
{'message': "Test 1 Successful! This is a test indeed! I'm ready to assist you with any questions or tasks you have. What's next?\n", 'sources': [], 'media': []}

Wait, can you try to do the same thing but with facebook login feature enabled? the only way i can get into it working before it bugged out is that i have to use login to the facebook feature