DIGITALCRIMINAL / ArchivedUltimaScraper

Scrape content from OnlyFans and Fansly
GNU General Public License v3.0
948 stars 39 forks source link

OnlyFans Username Being Overwritten on Run #309

Closed atompharms closed 1 year ago

atompharms commented 2 years ago

This seems like an odd issue, but when I run python3.10 start_ofd.py it's overwriting my username with "default" and then 404ing out.

I'm running on MacOS 10.14.6, Python 3.10.2. I clone the repo, run python3.10 start_ofd.py and the first time it opens the JSON files in nano, I fill out my username, paste the cookie, paste the x-bc, and paste the User-Agent. I select 1 for OnlyFans from the Select Site: menu, and in the background, I see it reformat the cookie, but also replace my username with "default".

The options for the profile are listed as: Choose Profiles: 0 = All | 1 = default and I've tried both all and default, but the script runs 10 times, 404ing out each time:

Auth (V1) Attempt 1/10
Auth 404'ed
Auth (V1) Attempt 2/10
Auth 404'ed
Auth (V1) Attempt 3/10
Auth 404'ed
Auth (V1) Attempt 4/10
Auth 404'ed
Auth (V1) Attempt 5/10
Auth 404'ed
Auth (V1) Attempt 6/10
Auth 404'ed
Auth (V1) Attempt 7/10
Auth 404'ed
Auth (V1) Attempt 8/10
Auth 404'ed
Auth (V1) Attempt 9/10
Auth 404'ed
Auth (V1) Attempt 10/10
Auth 404'ed
Traceback (most recent call last):
  File "/Users/[USER_REMOVED]/Code/personal/of-scraper-2/start_ofd.py", line 66, in <module>
    asyncio.run(main())
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
    return future.result()
  File "/Users/[USER_REMOVED]/Code/personal/of-scraper-2/start_ofd.py", line 52, in main
    api = await main_datascraper.start_datascraper(config, site_name)
  File "/Users/[USER_REMOVED]/Code/personal/of-scraper-2/datascraper/main_datascraper.py", line 129, in start_datascraper
    await default(datascraper)
  File "/Users/[USER_REMOVED]/Code/personal/of-scraper-2/datascraper/main_datascraper.py", line 74, in default
    setup, subscriptions = await account_setup(
  File "/Users/[USER_REMOVED]/Code/personal/of-scraper-2/helpers/main_helper.py", line 996, in account_setup
    authed = await auth.login()
  File "/Users/[USER_REMOVED]/Code/personal/of-scraper-2/apis/onlyfans/classes/auth_model.py", line 159, in login
    user = await self.get_user(auth_id)
  File "/Users/[USER_REMOVED]/Code/personal/of-scraper-2/apis/onlyfans/classes/auth_model.py", line 223, in get_user
    response["session_manager"] = self.session_manager
TypeError: 'NoneType' object does not support item assignment

I've tried running it with 2FA turned on and off, changing the "support_2fa" JSON entry to false and running it, and it has the same result.

I've gotten the script to work before on this machine, but it was before the most recent changes, any chance this isn't me being an idiot somehow?

x5nder commented 2 years ago

I have the same issue. Getting 404'ed and username reset to default...

SuibianP commented 2 years ago

Edit:

It seems working after I filled in the cookies as per the template (leaving empty those that are not in the request) instead of pasting the entire set of cookies from the web session.

It could have been better if a diagnostic is printed so as not to confuse the user, though.


Seems that the username reset happens before any authentication takes place, so most likely happens in response to something in the local validation phase when the config is parsed.

hujialun@localhost:~/OnlyFans> chmod -w .profiles/OnlyFans/default/auth.json 
hujialun@localhost:~/OnlyFans> python3.10 start_ofd.py 
Choose Sites: 0 = All | 1 = OnlyFans | 2 = Fansly | 3 = StarsAVN
1
Traceback (most recent call last):
  File "/home/hujialun/OnlyFans/start_ofd.py", line 66, in <module>
    asyncio.run(main())
  File "/usr/lib64/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib64/python3.10/asyncio/base_events.py", line 641, in run_until_complete
    return future.result()
  File "/home/hujialun/OnlyFans/start_ofd.py", line 52, in main
    api = await main_datascraper.start_datascraper(config, site_name)
  File "/home/hujialun/OnlyFans/datascraper/main_datascraper.py", line 129, in start_datascraper
    await default(datascraper)
  File "/home/hujialun/OnlyFans/datascraper/main_datascraper.py", line 55, in default
    await main_helper.process_profiles(api, global_settings)
  File "/home/hujialun/OnlyFans/helpers/main_helper.py", line 984, in process_profiles
    export_json(datas, user_auth_filepath)
  File "/home/hujialun/OnlyFans/helpers/main_helper.py", line 781, in export_json
    filepath.write_bytes(orjson.dumps(metadata, option=orjson.OPT_INDENT_2))
  File "/usr/lib64/python3.10/pathlib.py", line 1141, in write_bytes
    with self.open(mode='wb') as f:
  File "/usr/lib64/python3.10/pathlib.py", line 1117, in open
    return self._accessor.open(self, mode, buffering, encoding, errors,
PermissionError: [Errno 13] Permission denied: '.profiles/OnlyFans/default/auth.json'
atompharms commented 2 years ago

@SuibianP I still can't get it to work, it wipes my username still even if I only copy in the values for sess and auth_id into the cookie value. Anyone else?

x5nder commented 2 years ago

@SuibianP my profile looks like this (replaced the user ID for 12345678 for obvious reasons):

    "username": "default",
    "cookie": "auth_id=12345678; sess=tsom9rdrneian6g5688n46n4pd; auth_hash=; auth_uniq_12345678=; auth_uid_12345678=;",
    "x_bc": "b90b8e59adcfdc4ebd117d8191fb7f40c427b116",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36",
    "email": "",
    "password": "",
    "hashed": false,
    "support_2fa": true,
    "active": true

Did you do something else with the cookie settings/profile.json?

SuibianP commented 2 years ago

I also directly input my credentials into the spawned editor instead of preparing the file beforehand. Not sure if it really makes a difference though :thinking: Maybe try starting afresh without the configurations and do it all in one shot?

atompharms commented 2 years ago

Just checked back in, still having the same issue on a fresh install. No matter whether I fill out the info in Vi when it initially runs or if I add the info in later, still wipes all my info and replaces it with the default values.

DIGITALCRIMINAL commented 2 years ago

"username": "default", being changed doesn't matter.

If your credentials, I dunno why it wouldn't work.

emskia-bgp commented 2 years ago

I cannot login even after entering the email and password.. cookie and x_bc fields are filled correctly

Auth (V1) Attempt 1/10 Access denied. Auth (V1) Attempt 2/10 Access denied. Auth (V1) Attempt 3/10 Access denied. Auth (V1) Attempt 4/10 Access denied. Auth (V1) Attempt 5/10 Access denied. Auth (V1) Attempt 6/10 Access denied. Auth (V1) Attempt 7/10 Access denied. Auth (V1) Attempt 8/10 Access denied. Auth (V1) Attempt 9/10 Access denied. Auth (V1) Attempt 10/10

atompharms commented 2 years ago

So, I think I've been over thinking this. I've been filling out more fields in the auth.json file than I should be. Once I only added the fields from the README, it's working. I think I was adding in my username and password and copying the entire cookie return, and I was breaking it by giving too much auth info.

rj-135 commented 2 years ago

@atompharms, I am having the exact same issue that your OP was about.

Can you please explain what exactly you did to correct this error? I've tried only entering what is mentioned in the README, but I am still getting the 404 error on auth.

rj-135 commented 2 years ago

Nevermind, I figured it out...

I had to update the certificates in Python using this code:

sudo /Applications/Python\ 3.10/Install\ Certificates.command

atompharms commented 2 years ago

@rj-135 yeah, that works too. I ended up using the Poetry route that was the most reliable.

rushdrill commented 2 years ago

Nevermind, I figured it out...

I had to update the certificates in Python using this code:

sudo /Applications/Python\ 3.10/Install\ Certificates.command

how do you update the certificates? i still can't bypass the auth 404