Skip to content

Commit

Permalink
Handle 404'ed auths.
Browse files Browse the repository at this point in the history
OnlyFans have begun rate limiting :(

I'll probably implement a "bypass" soon.
  • Loading branch information
UltimaHoarder committed Apr 22, 2021
1 parent 4832fd3 commit 3dd1b0b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions apis/onlyfans/onlyfans.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,17 +597,20 @@ def resolve_auth(auth: create_auth):
auth.errors.remove(error)
break
resolve_auth(self.auth)
if self.auth.errors:
error = self.auth.errors[-1]
error_message = error.message
if "token" in error_message:
break
if "Code wrong" in error_message:
break
if not self.auth.active:
if self.auth.errors:
error = self.auth.errors[-1]
error_message = error.message
if "token" in error_message:
break
if "Code wrong" in error_message:
break
else:
print("Auth 404'ed")
continue
else:
print(f"Welcome {self.auth.name} | {self.auth.username}")
return self.auth
break

def get_authed(self) -> Union[create_auth]:
if not self.auth.active:
Expand All @@ -622,6 +625,7 @@ def get_authed(self) -> Union[create_auth]:
me_api.session_manager = self.session_manager
self.auth = me_api
else:
# 404'ed
self.auth.active = False
return self.auth

Expand Down

7 comments on commit 3dd1b0b

@secretiveolwagner
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this why the active session got logged out immediately as soon as I start using it?

@UltimaHoarder
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logged out via the browser?

@secretiveolwagner
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exactly what happened.

  1. I logged into my OF account on a browser, then used the onlyfans cooker helper extension for the script.
  2. Auth failed 10/10. I thought I screwed up the input.
  3. The same active browser became this, when I F5'ed it.
  4. It kept loading for several more times, eventually it logged itself out.

I also tried the auth via browser method. The script was able to logged in but then it said there's nothing to scrape. (This was done with default settings, I recloned this script to a different directory).

@LunarPenguin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for me if i get my auth wrong after a browser update or something like that it usually nukes the session in the browser as well

@UltimaHoarder
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exactly what happened.

  1. I logged into my OF account on a browser, then used the onlyfans cooker helper extension for the script.
  2. Auth failed 10/10. I thought I screwed up the input.
  3. The same active browser became this, when I F5'ed it.
  4. It kept loading for several more times, eventually it logged itself out.

I also tried the auth via browser method. The script was able to logged in but then it said there's nothing to scrape. (This was done with default settings, I recloned this script to a different directory).

for me if i get my auth wrong after a browser update or something like that it usually nukes the session in the browser as well

No, this doesn't touch the browser.

@UltimaHoarder
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exactly what happened.

  1. I logged into my OF account on a browser, then used the onlyfans cooker helper extension for the script.
  2. Auth failed 10/10. I thought I screwed up the input.
  3. The same active browser became this, when I F5'ed it.
  4. It kept loading for several more times, eventually it logged itself out.

I also tried the auth via browser method. The script was able to logged in but then it said there's nothing to scrape. (This was done with default settings, I recloned this script to a different directory).

I think I fixed your problem with the latest commit.

@secretiveolwagner
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exactly what happened.

  1. I logged into my OF account on a browser, then used the onlyfans cooker helper extension for the script.
  2. Auth failed 10/10. I thought I screwed up the input.
  3. The same active browser became this, when I F5'ed it.
  4. It kept loading for several more times, eventually it logged itself out.

I also tried the auth via browser method. The script was able to logged in but then it said there's nothing to scrape. (This was done with default settings, I recloned this script to a different directory).

I think I fixed your problem with the latest commit.

Yes, you did, cheers for that

Please sign in to comment.