This repository was archived by the owner on Sep 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Bypass Fa3 autism :( #11
Open
orithecapper
wants to merge
1
commit into
cibere:main
Choose a base branch
from
orithecapper:patch-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,13 @@ | |
import json | ||
import logging | ||
from typing import TYPE_CHECKING, Any, Coroutine, Optional, TypeVar, Union | ||
from curl_cffi import requests as requests_ORI | ||
|
||
from aiohttp import ClientConnectionError, ClientResponse, ClientSession | ||
|
||
from . import __version__ | ||
from .errors import ( | ||
CloudflareBypassException, | ||
# CloudflareBypassException, | ||
Forbidden, | ||
HTTPException, | ||
InternalKickException, | ||
|
@@ -58,7 +59,7 @@ | |
|
||
|
||
async def json_or_text(response: ClientResponse, /) -> Union[dict[str, Any], str]: | ||
text = await response.text() | ||
text = response.text | ||
try: | ||
try: | ||
return json.loads(text) | ||
|
@@ -236,22 +237,21 @@ async def request(self, route: Route, **kwargs) -> Any: | |
f"Making request to {route.method} {url}. headers: {headers}, params: {kwargs.get('params', None)}, json: {kwargs.get('json', None)}" | ||
) | ||
try: | ||
res = await self.__session.request( | ||
res = await requests_ORI.AsyncSession().request( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just like with aiohttp, the session should be reused and stored, not creating a new one |
||
route.method, | ||
url | ||
if self.whitelisted is True | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you're going to remove generating the url like this, you should also remove |
||
else f"{self.bypass_host}:{self.bypass_port}/request?url={url}", | ||
url, | ||
headers=headers, | ||
cookies=cookies, | ||
impersonate="safari15_3", | ||
**kwargs, | ||
) | ||
except ClientConnectionError: | ||
if self.whitelisted is True: | ||
raise InternalKickException("Could Not Connect To Kick") from None | ||
else: | ||
raise CloudflareBypassException( | ||
"Could Not Connect To Bypass Script" | ||
) from None | ||
# else: | ||
# raise CloudflareBypassException( | ||
# "Could Not Connect To Bypass Script" | ||
# ) from None | ||
|
||
if res is not None: | ||
self.xsrf_token = str( | ||
|
@@ -260,7 +260,7 @@ async def request(self, route: Route, **kwargs) -> Any: | |
|
||
data = await json_or_text(res) | ||
|
||
if res.status == 429: | ||
if res.status_code == 429: | ||
self.globally_locked = True | ||
LOGGER.warning( | ||
f"We have been ratelimited at {route.method} {route.url}. Waiting five seconds before trying again...", | ||
|
@@ -271,13 +271,13 @@ async def request(self, route: Route, **kwargs) -> Any: | |
else: | ||
self.globally_locked = False | ||
|
||
if 300 > res.status >= 200: | ||
if 300 > res.status_code >= 200: | ||
return data | ||
|
||
match res.status: | ||
match res.status_code: | ||
case 400: | ||
error = await error_or_text(data) | ||
raise HTTPException(error, res.status) | ||
raise HTTPException(error, res.status_code) | ||
case 403: | ||
raise Forbidden(await error_or_nothing(data)) | ||
case 404: | ||
|
@@ -300,10 +300,10 @@ async def request(self, route: Route, **kwargs) -> Any: | |
if res is not None and data is not None: | ||
txt = await error_or_text(data) | ||
|
||
if res.status >= 500: | ||
if res.status_code >= 500: | ||
raise InternalKickException(txt) | ||
|
||
raise HTTPException(txt, res.status) | ||
raise HTTPException(txt, res.status_code) | ||
|
||
raise RuntimeError("Unreachable situation occured in http handling") | ||
|
||
|
@@ -493,7 +493,7 @@ async def get_asset(self, url: str) -> bytes: | |
self.__session = ClientSession() | ||
|
||
res = await self.__session.request("GET", url) | ||
match res.status: | ||
match res.status_code: | ||
case 200: | ||
return await res.read() | ||
case 403: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no reason to change the name its imported under. Importing
curl_cffi
itself is better than changing the name of something from the library