Giter Club home page Giter Club logo

befake's People

Contributors

notmarek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

befake's Issues

Implement pagination to endpoints

Sorry for bothering you about API and stuff. I don't have any Android device to sniff and BeReal iOS app uses client-side SSL pinning which cannot be captured.

I want to get all recommended friends, not just the first page. bf.get_friend_suggestions() calls res = self.api_request("get", f"relationships/suggestions") which response has res["next"] field which looks like this: K2Cvai3i7rhdNhtqo3m1aAcYOT72.

I tried to pass it as a 'next' param but it still returns the first pagination page. I think it would be better if someone with Android device can check the proper one.

res = bf.api_request("get", f"relationships/suggestions")
res = bf.api_request("get", f"relationships/suggestions", params={"next": res["next"]})
# still returns the first page

Error on login: `'BeFake' object has no attribute 'refresh_token'`

I haven't dived super deep into the code, but it seems like we don't even try to set self.refresh_token anywhere. The API responses seem to indicate success. Maybe this is a regression from one of the latest commits? Does login currently work for anyone?

$ ./befake.py login <+4900000000000>
Enter otp: <000000>
Traceback (most recent call last):
  File "/home/nicolai/Daten/Programmieren/_Forks/BeFake/./befake.py", line 6, in <module>
    cli(obj={})
  File "/usr/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/nicolai/Daten/Programmieren/_Forks/BeFake/BeFake/__main__.py", line 55, in login
    bf.verify_otp_vonage(otp)
  File "/home/nicolai/Daten/Programmieren/_Forks/BeFake/BeFake/BeFake.py", line 240, in verify_otp_vonage
    self.firebase_refresh_tokens()
  File "/home/nicolai/Daten/Programmieren/_Forks/BeFake/BeFake/BeFake.py", line 294, in firebase_refresh_tokens
    self.save()
  File "/home/nicolai/Daten/Programmieren/_Forks/BeFake/BeFake/BeFake.py", line 76, in save
    session = {"access": {"refresh_token": self.refresh_token,
AttributeError: 'BeFake' object has no attribute 'refresh_token'. Did you mean: 'refresh_tokens'?

AttributeError: 'str' object has no attribute 'write'

I am receiving the following error when I run one of the feed commands on the latest version.

python3 -m BeFake feed discovery
Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.9/dist-packages/BeFake/__main__.py", line 385, in <module>
    cli(obj={})
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/BeFake/__main__.py", line 29, in wrapper
    return func(bf, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/BeFake/__main__.py", line 137, in feed
    click.echo(f"saving post by {item.user.username}".ljust(50, " "), f"{item.id}")
  File "/usr/local/lib/python3.9/dist-packages/click/utils.py", line 299, in echo
    file.write(out)  # type: ignore
AttributeError: 'str' object has no attribute 'write'


python3 -m BeFake feed friends
Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.9/dist-packages/BeFake/__main__.py", line 385, in <module>
    cli(obj={})
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/BeFake/__main__.py", line 29, in wrapper
    return func(bf, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/BeFake/__main__.py", line 137, in feed
    click.echo(f"saving post by {item.user.username}".ljust(50, " "), f"{item.id}")
  File "/usr/local/lib/python3.9/dist-packages/click/utils.py", line 299, in echo
    file.write(out)  # type: ignore
AttributeError: 'str' object has no attribute 'write'

Security Issue - Publicly Exposed API Key

In BeFake.py on line 46 you have an exposed api key.
image

Anyone with this key can make google api calls from your account - it might end up costing you money. Might be a good idea to revoke the key and change the code so that it pulls the api key through an environment variable instead.

Unable to post BeReal

When trying to post a BeReal using the post command an error occurs as the call to Post.create_post is missing a self.
TypeError: create_post() missing 1 required positional argument: 'self'

The command I executed: python3 BeFake.py post
Datafolder:
image

Viewing the posts in a nice way

Currently, there is no way in this repo to visualise the data, that is being downloaded.
That's why I made an application with Flask that currently only displays posts of friends.
You can find it here, if you are interested: https://github.com/ArtrenH/BeFake-Dashboard

(Sorry for creating an Issue for that, I didn't find a better way to post this but I thought y'all could find it interesting.)

403 Error with the post upload

So I wanted to use the upload function from your program, however it returns a 403 error on the PUT request, while the first POST request returns 200. I was wondering if you guys were familiar with this error/have delt with this aswell.

I changed just a few things in my code to be able to run inside my code.

def upload(self, secondary: bool = False, name: str = None):
        from urllib.parse import quote_plus
        img = Image.open(io.BytesIO(open("mexico.jpg","rb").read()))
        mime_type = Image.MIME[img.format]
        if mime_type != "image/jpeg":
            if not img.mode == "RGB":
                img = img.convert("RGB")
        img_data = io.BytesIO()
        img.save(img_data, format="JPEG", quality=90)
        img_data = img_data.getvalue()
        if name is None:
            name = f"Photos/{self.uid}/bereal/{uuid.uuid4()}-{int(pendulum.now().timestamp())}{'-secondary' if secondary else ''}.webp"
        json_data = {
            "cacheControl": "public,max-age=172800",
            "contentType": "image/webp",
            "metadata": {"type": "bereal"},
            "name": name,
        }
        headers = {
            "x-goog-upload-protocol": "resumable",
            "x-goog-upload-command": "start",
            "x-firebase-storage-version": "ios/9.4.0",
            "x-goog-upload-content-type": "image/webp",
            "Authorization": f"Firebase {self.auth_token}",
            "x-goog-upload-content-length": str(len(img_data)),
            "content-type": "application/json",
            "x-firebase-gmpid": "1:405768487586:ios:28c4df089ca92b89",
        }
        params = {
            "uploadType": "resumable",
            "name": name,
        }
        uri = f"https://firebasestorage.googleapis.com/v0/b/storage.bere.al/o/{quote_plus(name)}"
        # initate the upload
        init_res = requests.post(
            uri, headers=headers, params=params, data=json.dumps(json_data)
        )
        if init_res.status_code != 200:
            raise Exception(f"Error initiating upload: {init_res.status_code}")
        upload_url = init_res.headers["x-goog-upload-url"]
        headers = {
            "x-goog-upload-command": "upload, finalize",
            "x-goog-upload-protocol": "resumable",
            "x-goog-upload-offset": "0",
            "content-type": "image/jpeg",
        }
        # upload the image
        upload_res = requests.put(upload_url, headers=headers, data=img_data)
        self.print_response(upload_res)
        res_data = upload_res.json()

Unit tests

As the codebase starts to grow, we should implement unit tests for every BeFake functions, using sample JSON responses. I could provide those and feed them to BeFake using pytest.

Post upload fails

The upload function in Picture.py always fails with error 403, saying Permission Denied. I've tried a bunch of different phrasing for the Firebase authentication header with no success. Any ideas?

Crashes on login after putting in the otp code

The script dies right after I put in the otp code during login with the following trace:

Enter otp: XXXXXX
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/sircumalot/programming/befake/BeFake/BeFake/main.py", line 103, in
cli()
File "/home/sircumalot/.local/lib/python3.10/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/home/sircumalot/.local/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/sircumalot/.local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/sircumalot/.local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/sircumalot/.local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/sircumalot/programming/befake/BeFake/BeFake/main.py", line 20, in login
bf.verify_otp(otp)
File "/home/sircumalot/programming/befake/BeFake/BeFake/BeFake.py", line 75, in verify_otp
self.token_info = json.loads(b64decode(res["idToken"].split(".", 3)[1]))
File "/usr/lib/python3.10/base64.py", line 87, in b64decode
return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

`befake feed friends` gives `httpx.ReadTimeout`

Other commands like befake login, befake feed memories or befake parse-friends work as expected, which makes me believe there was a change to the API on their side, but I don't currently have the setup to reverse engineer it.
Does anybody else have the same problem?

Full exception
Traceback (most recent call last):
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 8, in map_exceptions
    yield
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpcore/backends/sync.py", line 26, in read
    return self._sock.recv(max_bytes)
  File "/usr/lib/python3.10/ssl.py", line 1259, in recv
    return self.read(buflen)
  File "/usr/lib/python3.10/ssl.py", line 1132, in read
    return self._sslobj.read(len)
TimeoutError: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
    yield
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 218, in handle_request
    resp = self._pool.handle_request(req)
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 253, in handle_request
    raise exc
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 237, in handle_request
    response = connection.handle_request(request)
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 90, in handle_request
    return self._connection.handle_request(request)
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpcore/_sync/http11.py", line 105, in handle_request
    raise exc
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpcore/_sync/http11.py", line 84, in handle_request
    ) = self._receive_response_headers(**kwargs)
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpcore/_sync/http11.py", line 148, in _receive_response_headers
    event = self._receive_event(timeout=timeout)
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpcore/_sync/http11.py", line 177, in _receive_event
    data = self._network_stream.read(
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpcore/backends/sync.py", line 24, in read
    with map_exceptions(exc_map):
  File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
    raise to_exc(exc)
httpcore.ReadTimeout: The read operation timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/nicolai/.local/bin//befake", line 8, in <module>
    sys.exit(cli())
  File "/home/nicolai/.local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/nicolai/.local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/nicolai/.local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/nicolai/.local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/nicolai/.local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/nicolai/.local/lib/python3.10/site-packages/BeFake/__main__.py", line 64, in feed
    feed = bf.get_friends_feed()
  File "/home/nicolai/.local/lib/python3.10/site-packages/BeFake/BeFake.py", line 155, in get_friends_feed
    res = self.client.get(
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpx/_client.py", line 1039, in get
    return self.request(
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpx/_client.py", line 815, in request
    return self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpx/_client.py", line 902, in send
    response = self._send_handling_auth(
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpx/_client.py", line 930, in _send_handling_auth
    response = self._send_handling_redirects(
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpx/_client.py", line 967, in _send_handling_redirects
    response = self._send_single_request(request)
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpx/_client.py", line 1003, in _send_single_request
    response = transport.handle_request(request)
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 217, in handle_request
    with map_httpcore_exceptions():
  File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/nicolai/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ReadTimeout: The read operation timed out

Posting error

Hi i assume bereal changed their api to be more secure because posting is currently not working

BUG: get_users_by_phone_number assertion error

I tried several ways to call that function but all the time I get the assertion inside api_request method. Perhaps the API endpoint method is incorrectly tested.

image

I'd also rename this method to get_users_by_phone_numbers because we pass a list of phone numbers, not just one.

Add License

The project has no license. You should consider adding one. Maybe MIT or BSD?

Add releases / version numbers

Since BeFake is a good candidate for automated running, adding releases / version numbers could allow users to

  • distinguish between breaking/non-breaking changes (assuming semver)
  • update to the latest minor version automatically
  • get notified on new releases (using GitHub's watch options)

Note that version 1.0.1 is currently specified in some places, such as

version = "1.0.1"

and
version='1.0.1',

No such option: -...

Some posts start with a "-" such as "-CakAOUnUe6ad6mNfUALOL" but it does not matter if I quote it with singular (') or with double quotes (") I can't seem to escape it.

Not sure if this is specific to the instant-realmoji function but what I am trying to do is that.

python3 BeFake/befake.py instant-realmoji -CakAOUnUe6ad6mLOL cool_username

Error 400 when trying to login

I try to login but I have always an error 😥

I printed res in send_otp() function and there is the result:
{'error': {'code': 400, 'message': 'QUOTA_EXCEEDED : Exceeded quota.', 'errors': [{'message': 'QUOTA_EXCEEDED : Exceeded quota.', 'domain': 'global', 'reason': 'invalid'}]}}

`parse-friends` and `upload-realmoji` are broken

befake parse-friends

Traceback (most recent call last):
  File "C:\Users\Jakub\anaconda3\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Jakub\anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Jakub\anaconda3\Scripts\befake.exe\__main__.py", line 7, in <module>
  File "C:\Users\Jakub\anaconda3\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\Jakub\anaconda3\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Users\Jakub\anaconda3\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\Jakub\anaconda3\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\Jakub\anaconda3\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\Jakub\anaconda3\lib\site-packages\BeFake\__main__.py", line 29, in wrapper
    return func(bf, *args, **kwargs)
  File "C:\Users\Jakub\anaconda3\lib\site-packages\BeFake\__main__.py", line 178, in parse_friends
    if friend.profile_picture.exists():
AttributeError: 'NoneType' object has no attribute 'exists'

befake upload-realmoji heartEyes image.jpg

Traceback (most recent call last):
  File "C:\Users\Jakub\anaconda3\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Jakub\anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Jakub\anaconda3\Scripts\befake.exe\__main__.py", line 7, in <module>
  File "C:\Users\Jakub\anaconda3\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\Jakub\anaconda3\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Users\Jakub\anaconda3\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\Jakub\anaconda3\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\Jakub\anaconda3\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\Jakub\anaconda3\lib\site-packages\BeFake\__main__.py", line 29, in wrapper
    return func(bf, *args, **kwargs)
  File "C:\Users\Jakub\anaconda3\lib\site-packages\BeFake\__main__.py", line 318, in upload_realmoji
    r = bf.upload_realmoji(data, emoji_type=type)
  File "C:\Users\Jakub\anaconda3\lib\site-packages\BeFake\BeFake.py", line 383, in upload_realmoji
    res = self.api_request("put", "person/me/realmojis", data=data, headers={"authorization": self.token})
  File "C:\Users\Jakub\anaconda3\lib\site-packages\BeFake\BeFake.py", line 92, in api_request
    res = self.client.request(
TypeError: httpx._client.Client.request() got multiple values for keyword argument 'headers'

The image is located in /data/photos

Windows 11 Version 10.0.22621 Build 22621
Python 3.9.12

Endpoint for getting mutual friends

Is there any endpoint to get userIds of mutualFriends?

I just have endpoints where the mutual friend count is exposed but there should also be one with the specific mutual friends.

question

is there an endpoint to search for a user with their username?

APP_NOT_VERIFIED on logging in

Receiving an error while logging in
$ befake login [NUMBER]

response from server:
{'error': {'code': 400, 'errors': [{'domain': 'global', 'message': 'APP_NOT_VERIFIED', 'reason': 'invalid'}], 'message': 'APP_NOT_VERIFIED'}}

Command : python -m BeFake login : Gives error

Cooamdn : python -m BeFake login
Error :

Traceback (most recent call last):
  File "/home/hemang/anaconda3/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/hemang/anaconda3/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/hemang/Documents/GitHub/BeFake/BeFake/__main__.py", line 3, in <module>
    from BeFake import BeFake
  File "/home/hemang/Documents/GitHub/BeFake/BeFake/BeFake.py", line 6, in <module>
    from models.picture import Picture
ModuleNotFoundError: No module named 'models'

I think it fails to import from folder.
hjlabs.in

Unable to login

When I want to connect and I put my code received by sms, it gives me this error:

WARNING: Concurrent verifications to the same number are not allowed
If you already received a code before, ignore the warning and enter it.
Enter otp: 744339
Traceback (most recent call last):
  File "C:\Users\ney\Desktop\BeFake-master\befake.py", line 6, in <module>
    cli(obj={})
  File "C:\Users\ney\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ney\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\ney\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ney\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ney\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ney\Desktop\BeFake-master\BeFake\__main__.py", line 49, in login
    bf.verify_otp(otp)
  File "C:\Users\ney\Desktop\BeFake-master\BeFake\BeFake.py", line 137, in verify_otp
    "token": vonageRes["token"],
             ~~~~~~~~~^^^^^^^^^
KeyError: 'token'

bereal token expiring after a day

File "/usr/local/lib/python3.9/dist-packages/BeFake/__main__.py", line 28, in wrapper raise Exception("No token found, are you logged in?") Exception: No token found, are you logged in?
I run a bot 24/7 on a vps i check back on it and after about a day it starts throwing this exception and i need to re log in with my phone num.
can provide more info if needed

Can't Login

Hi there when I try to login I get following Error:

C:\Users\ASUS\Desktop\MENA\BeReal\BeFake> python befake.py login +20**********
Traceback (most recent call last):
File "C:\Users\ASUS\Desktop\MENA\BeReal\BeFake\befake.py", line 6, in
cli(obj={})
File "C:\Users\ASUS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\click\core.py", line 1130, in call
return self.main(*args, **kwargs)
File "C:\Users\ASUS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
File "C:\Users\ASUS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\click\core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\ASUS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\ASUS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\click\core.py", line 760, in invoke
return _callback(*args, **kwargs)
File "C:\Users\ASUS\Desktop\MENA\BeReal\BeFake\BeFake_main
.py", line 50, in login
bf.send_otp_vonage(phone_number)
File "C:\Users\ASUS\Desktop\MENA\BeReal\BeFake\BeFake\BeFake.py", line 184, in send_otp_vonage
if vonageRes.json()["status"] != '0':
KeyError: 'status'

Can somebody help me please? :-)

unable to login - INVALID_APP_CREDENTIAL

any one same with me?

{ "error": { "code": 400, "message": "INVALID_APP_CREDENTIAL", "errors": [ { "message": "INVALID_APP_CREDENTIAL", "domain": "global", "reason": "invalid" } ] } }

problem with new version

oot@debian:~# befake parse-friends
Traceback (most recent call last):
File "/usr/local/bin/befake", line 8, in
sys.exit(cli())
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/BeFake/main.py", line 146, in parse_friends
creation_date = friend.profile_picture.get_date().format(date_format)
AttributeError: 'NoneType' object has no attribute 'format'

does anyone else have the same problem?

root@debian:~# pip list | grep -i befake
BeFake 1.0.1

Add support for extra bereals

The latest bereal version added support for users to post extra bereals if they posted their first bereal on time, but the current friends feed command does not seem to download these extra bereals.

Receiving Bad Request 400 response when refreshing token

Whenever tokens are attempted to be refreshed after the initial token from the login has expired I am receiving a status 400 response.

Traceback (most recent call last): File "/home/pi/.local/lib/python3.9/site-packages/BeFake/__main__.py", line 26, in wrapper bf.load() File "/home/pi/.local/lib/python3.9/site-packages/BeFake/BeFake.py", line 101, in load self.refresh_tokens() File "/home/pi/.local/lib/python3.9/site-packages/BeFake/BeFake.py", line 250, in refresh_tokens raise Exception(res.content) Exception: b'{"error":"Bad Request","statusCode":400,"message":"Bad Request","errorKey":null,"fields":null,"timestamp":"2023-05-01T11:01:39.013Z","requestId":"aa0389102c50b1b3a59a24ebeb80ca7c"}'

Better default `--save-location`?

I find it odd that only the default --save-location of the memories feed includes a {date}, because IMHO it is much more helpful for organizing than having just the {post_id}.
How about formatting the post-level directory for other feed types like {date} [{post_id}] instead, similar to yt-dlp's default template?

if feed_id == "memories":
save_location = f"{DATA_DIR}" + "/feeds/memories/{date}"
else:
save_location = f"{DATA_DIR}" + "/feeds/{feed_id}/{user}/{post_id}"

Unable to post with error: 'old-post'

Hi! I get this error when trying to post a BeReal. It's a late BeReal, but if I set "is_late" to True or False, I get the same error. I'm not exactly sure what's causing it:

{'error': 'Bad Request', 'statusCode': 400, 'message': 'Bad Request', 'errorKey': 'old-post', 'fields': None, 'timestamp': '2023-03-27T02:58:30.760Z', 'requestId': '[I removed this]'}

f ?

        "Authorization": f"Firebase {befake.token}",

f ?

Login

When i try to login i get this error.

Enter otp: 895789 Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Users\spart\AppData\Local\Programs\Python\Python311\Scripts\befake.exe\__main__.py", line 7, in <module> File "C:\Users\spart\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1130, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\spart\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1055, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\spart\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\spart\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\spart\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 760, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\spart\AppData\Local\Programs\Python\Python311\Lib\site-packages\BeFake\__main__.py", line 52, in login bf.verify_otp_vonage(otp) File "C:\Users\spart\AppData\Local\Programs\Python\Python311\Lib\site-packages\BeFake\BeFake.py", line 184, in verify_otp_vonage print("Error: " + vonageRes.json()["statusCode"] + vonageRes.json()["message"]) ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TypeError: can only concatenate str (not "int") to str

Unable to log in

When I try to log into my BeReal account I get the following error:

File "C:\___\BeFake\BeFake.py", line 95, in send_otp
    self.otp_session = res["sessionInfo"]
KeyError: 'sessionInfo'

I believe this is because res is returning the following data:

{'error': {'code': 400, 'message': 'INVALID_APP_CREDENTIAL : Invalid receipt.', 'errors': [{'message': 'INVALID_APP_CREDENTIAL : Invalid receipt.', 'domain': 'global', 'reason': 'invalid'}]}}

I have set up google API key, identity tools and firebase with phone authentication.
What should I set the iosReceipt as? Do I need to change the api_url in the BeFake class?

unable to login

I cannot manage to login :

.....BeFake/BeFake/BeFake.py", line 99, in send_otp
self.otp_session = res["sessionInfo"]
~~~^^^^^^^^^^^^^^^
KeyError: 'sessionInfo'

New version/release, befake 1.1.0?

Hello! A lot of code has been changed recently, I think it might be time to make a new release on PyPI and on GitHub.
@notmarek let me know what you think, some things are still needed to be sorted out like instant realmojis, they currently do not work for me.

Gif upload

Apparently, users can now react with gifs (seems to be an IOS-Update so far). I wasn't able to implement it just by changing every type in realmoji_picture.py from jpeg to gif (I could upload it but with only one frame), because the server afterwards didn't accept my request where I sent the url to the uploaded image (Bad argument error).

Does anyone know how to fix that and how to react with gifs via the API?

403 Forbidden

python3 -m BeFake feed friends
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.9/dist-packages/BeFake/main.py", line 378, in
cli(obj={})
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/BeFake/main.py", line 29, in wrapper
return func(bf, *args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/BeFake/main.py", line 102, in feed
feed = bf.get_friends_feed()
File "/usr/local/lib/python3.9/dist-packages/BeFake/BeFake.py", line 238, in get_friends_feed
res = self.api_request("get", "feeds/friends")
File "/usr/local/lib/python3.9/dist-packages/BeFake/BeFake.py", line 98, in api_request
res.raise_for_status()
File "/usr/local/lib/python3.9/dist-packages/httpx/_models.py", line 736, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '403 Forbidden' for url 'https://mobile.bereal.com/api/feeds/friends'
For more information check: https://httpstatuses.com/403

or

python3 -m BeFake me
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.9/dist-packages/BeFake/main.py", line 378, in
cli(obj={})
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/BeFake/main.py", line 29, in wrapper
return func(bf, *args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/BeFake/main.py", line 79, in me
user = bf.get_user_info()
File "/usr/local/lib/python3.9/dist-packages/BeFake/BeFake.py", line 228, in get_user_info
res = self.api_request("get", "person/me")
File "/usr/local/lib/python3.9/dist-packages/BeFake/BeFake.py", line 98, in api_request
res.raise_for_status()
File "/usr/local/lib/python3.9/dist-packages/httpx/_models.py", line 736, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '403 Forbidden' for url 'https://mobile.bereal.com/api/person/me'
For more information check: https://httpstatuses.com/403

i tied refreshing the token and logging in again but so far the same error…

Can't share a bereal (upload a picture to the servers)

befake.py post -v friends -r 0 -R false data\photos\primary.webp data\photos\secondary.webp

Traceback (most recent call last):
File "C:\Users\SCHUMI\Documents\BeFake\befake.py", line 6, in
cli(obj={})
File "C:\Users\SCHUMI\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1130, in call
return self.main(*args, **kwargs)
File "C:\Users\SCHUMI\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
File "C:\Users\SCHUMI\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\SCHUMI\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\SCHUMI\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 760, in invoke
return callback(*args, **kwargs)
File "C:\Users\SCHUMI\Documents\BeFake\BeFake_main
.py", line 29, in wrapper
return func(bf, *args, **kwargs)
File "C:\Users\SCHUMI\Documents\BeFake\BeFake_main
.py", line 212, in post
r = Post.create_post(bf, primary=primary_bytes, secondary=secondary_bytes, is_late=False, visibility=visibility, caption=caption, location=loc, retakes=retakes, resize=resize)
File "C:\Users\SCHUMI\Documents\BeFake\BeFake\models\post.py", line 102, in create_post
raise Exception(f"Error making the post: {res.status_code}")
Exception: Error making the post: 403

Any help please !?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.