Strvm / meta-ai-api

Llama 3 API (MetaAI Reverse Engineered)
158 stars 27 forks source link

Imagine Feature Request #3

Closed wrhsd1 closed 2 months ago

wrhsd1 commented 2 months ago

Could you add a login feature? Because using the prompt Imagine: prompt indicates that you need to log in {'message': 'Please log in to generate images.\n', 'sources': []} Thank you for your work.

Strvm commented 2 months ago

I'll try and look into being able to login with your FB account using email+password

wrhsd1 commented 2 months ago

Thank you for your response.

Strvm commented 2 months ago

Hi @wrhsd1 , in the latest release I added the ability to authenticate with your FB account to generate images. Here is how you can use it:

ai = MetaAI(fb_email="email", fb_password="pass")
print(ai.prompt(message="generate a random image"))
{
   "message":"I generated and sent you four images of random image.\n",
   "sources":[

   ],
   "media":[
      {
         "url":"https://scontent-lax3-1.xx.fbcdn.net/o1/v/t0/f1/m247/4741319775665569157_4161563403_21-04-2024-14-24-43.jpeg?_nc_ht=scontent-lax3-1.xx.fbcdn.net&_nc_cat=102&ccb=9-4&oh=00_AfCyzrva8cSk4ZrD8YKQ0ocyLqVUNvUYyRGBoKFHLIpsLg&oe=662747FE&_nc_sid=5b3566",
         "type":"IMAGE",
         "prompt":"random image"
      },
      {
         "url":"https://scontent-lax3-1.xx.fbcdn.net/o1/v/t0/f1/m247/4252388431296664059_873155699_21-04-2024-14-24-43.jpeg?_nc_ht=scontent-lax3-1.xx.fbcdn.net&_nc_cat=105&ccb=9-4&oh=00_AfBi5s3MiNj5i00ww49nK8Z7PxJTdTOd0P87qGEGJtodFA&oe=66275D1A&_nc_sid=5b3566",
         "type":"IMAGE",
         "prompt":"random image"
      },
      {
         "url":"https://scontent-lax3-1.xx.fbcdn.net/o1/v/t0/f1/m247/4902568689305718591_2389386087_21-04-2024-14-24-44.jpeg?_nc_ht=scontent-lax3-1.xx.fbcdn.net&_nc_cat=107&ccb=9-4&oh=00_AfAFKOTHF02sNJNNMFXzOqg5ZDvmx8sOTaBGSXj2v-cG1A&oe=662754A9&_nc_sid=5b3566",
         "type":"IMAGE",
         "prompt":"random image"
      },
      {
         "url":"https://scontent-lax3-1.xx.fbcdn.net/o1/v/t0/f1/m247/162904227134883459_169697324_21-04-2024-14-24-43.jpeg?_nc_ht=scontent-lax3-1.xx.fbcdn.net&_nc_cat=102&ccb=9-4&oh=00_AfDlXKCORpRbi_aHZ6QVF8eHB0LRacHz8uGo39N4xEjufQ&oe=66276839&_nc_sid=5b3566",
         "type":"IMAGE",
         "prompt":"random image"
      }
   ]
}

Random Image

wrhsd1 commented 2 months ago

Great work! Thanks a lot. @Strvm

alexlaverty commented 2 months ago

I had two factor auth enabled on facebook so was getting the following error :

Traceback (most recent call last):

File "d:\src\ai-video\app-meta.py", line 2, in <module>

ai = MetaAI(fb_email="********", fb_password="********")

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "c:\Users\alave\AppData\Local\Programs\Python\Python311\Lib\site-packages\meta_ai_api\main.py", line 50, in __init__

self.cookies = self.get_cookies()

^^^^^^^^^^^^^^^^^^

File "c:\Users\alave\AppData\Local\Programs\Python\Python311\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 "c:\Users\alave\AppData\Local\Programs\Python\Python311\Lib\site-packages\meta_ai_api\utils.py", line 149, in get_fb_session

raise FacebookInvalidCredentialsException(

meta_ai_api.exceptions.FacebookInvalidCredentialsException: Was not able to login to Facebook. Please check your credentials. You may also have been rate limited. Try to connect to Facebook manually.

After disabling Two factor auth was still having issues, so I had to follow these steps and then was able to get it working :

Log in through Instagram and go to the “Accounts Center” in “Settings and privacy”.

Go to “Personal details”.

Go to “Account ownership and control”.

Go to “Deactivation or deletion”.

Go to your Facebook account.

Select “Deactivate account” and go to “Continue” (DO NOT SELECT “DELETE ACCOUNT”).

Go to “Continue” again and enter your password.

Select “This is temporary, I’ll be back.” and go to “Continue”.

Select “Don’t reactivate automatically” under “Automatically reactivate my account in:” and then go to “Continue”.

Make sure to select the option to leave Messenger active (if it gives you the option) and go to “Deactivate my account”.

Get on a browser and log into your Facebook account.

Congratulations, you are back into your Facebook account and can set up your 2FA again if you wish!

source - https://www.reddit.com/r/facebook/comments/183mg19/comment/kdirzkj/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

However majority of the time when I run the script it's blocked and I get these notifications popping up in Facebook :

image