TachiyomiSY icon indicating copy to clipboard operation
TachiyomiSY copied to clipboard

feat: add FlareSolverr to bypass cloudflare

Open kaiserbh opened this issue 11 months ago • 12 comments

Added https://github.com/FlareSolverr/FlareSolverr to bypass cloudflare anti-bot protection.

A brief summary of FlareSolverr:

FlareSolverr is a proxy server designed to bypass Cloudflare and DDoS-GUARD protection. It works by starting a proxy server that uses Selenium with undetected-chromedriver to open a web browser (Chrome), navigate to a URL with user parameters, and wait until the Cloudflare challenge is solved before sending back the HTML code and cookies. These cookies can then be used to bypass Cloudflare with other HTTP clients.

Before and after

With FlareSolverr Without
Hello OKay

Settings in the advance section.

Video:

Without flareSolverr

https://github.com/jobobby04/TachiyomiSY/assets/41852205/23677279-0c1f-4b8a-8dbd-5597dcd804ea

With FlareSolverr

https://github.com/jobobby04/TachiyomiSY/assets/41852205/dee7ac92-7ed7-4b87-bf2d-ec93d4c7fec8

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 restart~~

Ignore 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.

sousou-no-frieren-frieren

kaiserbh avatar Mar 18 '24 14:03 kaiserbh

Do we still need to enable DoH when using this?🤔

NeKoOuO avatar Mar 19 '24 05:03 NeKoOuO

Do we still need to enable DoH when using this?🤔

Don't think so, but I tested it with both and works with and without.

kaiserbh avatar Mar 19 '24 05:03 kaiserbh

Does this PR include the functionality of adding Captcha Solvers in addition ?🤔

NeKoOuO avatar Apr 05 '24 04:04 NeKoOuO

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.

kaiserbh avatar Apr 05 '24 05:04 kaiserbh

Hey! @kaiserbh I would like to ask for your help with something Since "i18n/.../strings.xml" is strings Fork from the mihon, new features of SY will basically be placed in i18n-sy for differentiation This way during the translation process it will not be confused with the original Thanks!😊

Also syncyomi's strings https://github.com/jobobby04/TachiyomiSY/pull/1005

NeKoOuO avatar Apr 11 '24 15:04 NeKoOuO

Refactored. But flareSolverr is not working on my linux for some reason getting hit into timeout loop (https://github.com/FlareSolverr/FlareSolverr/issues/1036), so I will need to test this on windows, don't merge it yet.

kaiserbh avatar Apr 13 '24 23:04 kaiserbh

Try changing the timeout on the network okhttpclient

jobobby04 avatar Apr 13 '24 23:04 jobobby04

Okay so @jobobby04, this works well kinda, I can't get it to work when I use the networkhelper cookie manager... But If I use the cookieManager: CookieManager = CookieManager.getInstance() It works fine, well it fails to load the browse page (refer to the video basically that) the first time it fetches but it works afterwards. I don't know how the cookie manager works and It should technically work as we are building new request with the cookies. If you can have a look at this and see what's the issue, I would appreciate it.

I made two commit, one with the network helper cookie jar (https://github.com/jobobby04/TachiyomiSY/pull/1124/commits/89023559666c1d45619d78b6ce498526fd9ab464) and the other one accessing it directly (https://github.com/jobobby04/TachiyomiSY/pull/1124/commits/edf35a0a3655cf2a832fa7dd2c7b5cd5028a0bbb).

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.

kaiserbh avatar Jun 06 '24 14:06 kaiserbh

Any good news here? 🫠

NeKoOuO avatar Jul 24 '24 15:07 NeKoOuO

is this working yet?

cuong-tran avatar Aug 02 '24 06:08 cuong-tran

@kaiserbh Do u wanna try merge on Komikku…?

NeKoOuO avatar Aug 02 '24 06:08 NeKoOuO

it's abandoning ? the idea was great!

pixelroll avatar Sep 11 '24 21:09 pixelroll