-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add FlareSolverr to bypass cloudflare #1124
base: master
Are you sure you want to change the base?
feat: add FlareSolverr to bypass cloudflare #1124
Conversation
Signed-off-by: KaiserBh <[email protected]>
…o feat/add-flare-solverr-bypass-cf
Signed-off-by: KaiserBh <[email protected]>
Signed-off-by: KaiserBh <[email protected]>
Signed-off-by: KaiserBh <[email protected]>
I don't think reverse proxy going to work maybe it does but no luck on my end not that I need it tbh, I think using tailscale or wireguard should suffice and safer as there is no security in flaresolverr. Signed-off-by: KaiserBh <[email protected]>
We should make sure the cookie is attached when the request proceeds that way we don't have to relay on the app cookie jar state, for example we get the result immediately instead of going out of the extension and going back in, same withe the chapters, they use subdomain and it's random, so we need to make sure the cf_clearance is added to the subdomains dynamically. Signed-off-by: KaiserBh <[email protected]>
Signed-off-by: KaiserBh <[email protected]>
This comment has been minimized.
This comment has been minimized.
Don't think so, but I tested it with both and works with and without. |
Does this PR include the functionality of adding Captcha Solvers in addition ?🤔 |
It's possible, but that depends on you, FlareSolverr already has the capability. https://github.com/FlareSolverr/FlareSolverr?tab=readme-ov-file#environment-variables You can read more on it. |
This comment has been minimized.
This comment has been minimized.
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.
Here is a Suwayomi implementation of FlareSolverr that uses some of my comments. Feel free to take things from it.
https://github.com/Suwayomi/Suwayomi-Server/pull/844/files
app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt
Outdated
Show resolved
Hide resolved
…o feat/add-flare-solverr-bypass-cf
Signed-off-by: KaiserBh <[email protected]>
Refactored. |
Try changing the timeout on the network okhttpclient |
…/add-flare-solverr-bypass-cf
So this kinda works, it sets the cookie in the jar but for some reason fails to retrieve it. But if I directly use CookieManager.getInstance() It works fine??
So this is the working version using CookieManager Directly.
Okay so @jobobby04, this works well kinda, I can't get it to work when I use the I made two commit, one with the network helper cookie jar (8902355) and the other one accessing it directly (edf35a0). Also I am using this version of FlareSolverr: ---
version: "2.1"
services:
flaresolverr:
# DockerHub mirror flaresolverr/flaresolverr:latest
image: 21hsmw/flaresolverr:nodriver
container_name: flaresolverr2
environment:
- LOG_LEVEL=${LOG_LEVEL:-info}
- LOG_HTML=${LOG_HTML:-false}
- CAPTCHA_SOLVER=${CAPTCHA_SOLVER:-none}
- TZ=UTC
ports:
- "${PORT:-8191}:8191"
restart: unless-stopped Since the other ones doesn't seem to work. |
This comment has been minimized.
This comment has been minimized.
is this working yet? |
) { | ||
val json: Json by injectLazy() | ||
val jsonMediaType = "application/json".toMediaType() | ||
val client = OkHttpClient.Builder().build() |
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.
Can we use the networkManager http client here?
@@ -51,4 +52,40 @@ class AndroidCookieJar : CookieJar { | |||
fun removeAll() { | |||
manager.removeAllCookies {} | |||
} | |||
|
|||
fun addAll(url: HttpUrl, cookies: List<Cookie>) { |
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.
Remove debug logs if you are done with them, cookies shouldn't be logged if possible
<string name="pref_flare_solverr_url_summary">URL of the FlareSolverr instance to use for example http://192.168.1.202:8191/v1</string> | ||
<string name="pref_test_flare_solverr_and_update_user_agent">Test FlareSolverr and update user agent</string> | ||
<string name="pref_test_flare_solverr_and_update_user_agent_summary">Test FlareSolverr to update the user agent. Only required once; then toggle as needed.</string> | ||
|
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.
SY strings should go in i18n-sy
return chain.proceed(originalRequest) | ||
} | ||
|
||
Log.d("FlareSolverrInterceptor", "Intercepting request: ${originalRequest.url}") |
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.
All logs should use logcat()
it's abandoning ? the idea was great! |
Added https://github.com/FlareSolverr/FlareSolverr to bypass cloudflare anti-bot protection.
A brief summary of FlareSolverr:
Before and after
Settings in the advance section.
Video:
Without flareSolverr
Screen_recording_not_working.mp4
With FlareSolverr
flareSolverr_works_compressed_700k.mp4
Note
I think everything works fine but I am not sure if the cookie will be persisted at the start, for example in the flaresolverr video it shows no result found even though it managed to get the cookie. Not sure exactly but unless we restartIgnore the above pushed a fix for it, I should have used the cookie in the Header asap instead of waiting for it to populate cookie jar. The stuff like no result or click on chapter and clicking retry as well it's fixed. Essentially it should load on first visit. Of course that is if the source is working.