mirror of
https://github.com/FlareSolverr/FlareSolverr.git
synced 2025-12-06 17:48:40 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff65b7cc68 | ||
|
|
409e0844a7 | ||
|
|
368d5d4e05 | ||
|
|
c7505e3cbf | ||
|
|
5a27090abe | ||
|
|
e505ea4fe4 |
11
.github/workflows/release.yml
vendored
11
.github/workflows/release.yml
vendored
@@ -19,15 +19,14 @@ jobs:
|
|||||||
id: github_changelog
|
id: github_changelog
|
||||||
run: |
|
run: |
|
||||||
changelog=$(git log $(git tag | tail -2 | head -1)..HEAD --no-merges --oneline)
|
changelog=$(git log $(git tag | tail -2 | head -1)..HEAD --no-merges --oneline)
|
||||||
changelog="${changelog//'%'/'%25'}"
|
echo "changelog<<EOF" >> $GITHUB_OUTPUT
|
||||||
changelog="${changelog//$'\n'/'%0A'}"
|
echo "$changelog" >> $GITHUB_OUTPUT
|
||||||
changelog="${changelog//$'\r'/'%0D'}"
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
echo "changelog=${changelog}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
body: ${{ env.changelog }}
|
body: ${{ steps.github_changelog.outputs.changelog }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
||||||
|
|
||||||
@@ -47,7 +46,7 @@ jobs:
|
|||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v6
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: "3.14"
|
python-version: "3.13"
|
||||||
|
|
||||||
- name: Build artifacts
|
- name: Build artifacts
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v3.4.6 (2025/11/29)
|
||||||
|
* Add disable image, css, fonts option with CDP. Thanks @Ananto30
|
||||||
|
|
||||||
|
## v3.4.5 (2025/11/11)
|
||||||
|
* Revert to Python v3.13
|
||||||
|
|
||||||
## v3.4.4 (2025/11/04)
|
## v3.4.4 (2025/11/04)
|
||||||
* Bump dependencies, Chromium, and some other general fixes. Thanks @flowerey
|
* Bump dependencies, Chromium, and some other general fixes. Thanks @flowerey
|
||||||
|
|
||||||
|
|||||||
14
Dockerfile
14
Dockerfile
@@ -1,4 +1,4 @@
|
|||||||
FROM python:3.14-slim-bookworm as builder
|
FROM python:3.13-slim-bookworm AS builder
|
||||||
|
|
||||||
# Build dummy packages to skip installing them and their dependencies
|
# Build dummy packages to skip installing them and their dependencies
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
@@ -12,7 +12,7 @@ RUN apt-get update \
|
|||||||
&& equivs-build adwaita-icon-theme \
|
&& equivs-build adwaita-icon-theme \
|
||||||
&& mv adwaita-icon-theme_*.deb /adwaita-icon-theme.deb
|
&& mv adwaita-icon-theme_*.deb /adwaita-icon-theme.deb
|
||||||
|
|
||||||
FROM python:3.14-slim-bookworm
|
FROM python:3.13-slim-bookworm
|
||||||
|
|
||||||
# Copy dummy packages
|
# Copy dummy packages
|
||||||
COPY --from=builder /*.deb /
|
COPY --from=builder /*.deb /
|
||||||
@@ -67,17 +67,17 @@ ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
|||||||
CMD ["/usr/local/bin/python", "-u", "/app/flaresolverr.py"]
|
CMD ["/usr/local/bin/python", "-u", "/app/flaresolverr.py"]
|
||||||
|
|
||||||
# Local build
|
# Local build
|
||||||
# docker build -t ngosang/flaresolverr:3.4.4 .
|
# docker build -t ngosang/flaresolverr:3.4.6 .
|
||||||
# docker run -p 8191:8191 ngosang/flaresolverr:3.4.4
|
# docker run -p 8191:8191 ngosang/flaresolverr:3.4.6
|
||||||
|
|
||||||
# Multi-arch build
|
# Multi-arch build
|
||||||
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||||
# docker buildx create --use
|
# docker buildx create --use
|
||||||
# docker buildx build -t ngosang/flaresolverr:3.4.4 --platform linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8 .
|
# docker buildx build -t ngosang/flaresolverr:3.4.6 --platform linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8 .
|
||||||
# add --push to publish in DockerHub
|
# add --push to publish in DockerHub
|
||||||
|
|
||||||
# Test multi-arch build
|
# Test multi-arch build
|
||||||
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||||
# docker buildx create --use
|
# docker buildx create --use
|
||||||
# docker buildx build -t ngosang/flaresolverr:3.4.4 --platform linux/arm/v7 --load .
|
# docker buildx build -t ngosang/flaresolverr:3.4.6 --platform linux/arm/v7 --load .
|
||||||
# docker run -p 8191:8191 --platform linux/arm/v7 ngosang/flaresolverr:3.4.4
|
# docker run -p 8191:8191 --platform linux/arm/v7 ngosang/flaresolverr:3.4.6
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ This is the recommended way for Windows users.
|
|||||||
> **Warning**
|
> **Warning**
|
||||||
> Installing from source code only works for x64 architecture. For other architectures see Docker images.
|
> Installing from source code only works for x64 architecture. For other architectures see Docker images.
|
||||||
|
|
||||||
* Install [Python 3.14](https://www.python.org/downloads/).
|
* Install [Python 3.13](https://www.python.org/downloads/).
|
||||||
* Install [Chrome](https://www.google.com/intl/en_us/chrome/) (all OS) or [Chromium](https://www.chromium.org/getting-involved/download-chromium/) (just Linux, it doesn't work in Windows) web browser.
|
* Install [Chrome](https://www.google.com/intl/en_us/chrome/) (all OS) or [Chromium](https://www.chromium.org/getting-involved/download-chromium/) (just Linux, it doesn't work in Windows) web browser.
|
||||||
* (Only in Linux) Install [Xvfb](https://en.wikipedia.org/wiki/Xvfb) package.
|
* (Only in Linux) Install [Xvfb](https://en.wikipedia.org/wiki/Xvfb) package.
|
||||||
* (Only in macOS) Install [XQuartz](https://www.xquartz.org/) package.
|
* (Only in macOS) Install [XQuartz](https://www.xquartz.org/) package.
|
||||||
@@ -89,8 +89,8 @@ This is the recommended way for Windows users.
|
|||||||
|
|
||||||
* Run `pkg install chromium python313 py313-pip xorg-vfbserver` command to install the required dependencies.
|
* Run `pkg install chromium python313 py313-pip xorg-vfbserver` command to install the required dependencies.
|
||||||
* Clone this repository and open a shell in that path.
|
* Clone this repository and open a shell in that path.
|
||||||
* Run `python3.14 -m pip install -r requirements.txt` command to install FlareSolverr dependencies.
|
* Run `python3.13 -m pip install -r requirements.txt` command to install FlareSolverr dependencies.
|
||||||
* Run `python3.14 src/flaresolverr.py` command to start FlareSolverr.
|
* Run `python3.13 src/flaresolverr.py` command to start FlareSolverr.
|
||||||
|
|
||||||
### Systemd service
|
### Systemd service
|
||||||
|
|
||||||
@@ -190,6 +190,7 @@ session. When you no longer need to use a session you should make sure to close
|
|||||||
| returnScreenshot | Optional, default false. Captures a screenshot of the final rendered page after all challenges and waits are completed. The screenshot is returned as a Base64-encoded PNG string in the `screenshot` field of the response. |
|
| returnScreenshot | Optional, default false. Captures a screenshot of the final rendered page after all challenges and waits are completed. The screenshot is returned as a Base64-encoded PNG string in the `screenshot` field of the response. |
|
||||||
| proxy | Optional, default disabled. Eg: `"proxy": {"url": "http://127.0.0.1:8888"}`. You must include the proxy schema in the URL: `http://`, `socks4://` or `socks5://`. Authorization (username/password) is not supported. (When the `session` parameter is set, the proxy is ignored; a session specific proxy can be set in `sessions.create`.) |
|
| proxy | Optional, default disabled. Eg: `"proxy": {"url": "http://127.0.0.1:8888"}`. You must include the proxy schema in the URL: `http://`, `socks4://` or `socks5://`. Authorization (username/password) is not supported. (When the `session` parameter is set, the proxy is ignored; a session specific proxy can be set in `sessions.create`.) |
|
||||||
| waitInSeconds | Optional, default none. Length to wait in seconds after solving the challenge, and before returning the results. Useful to allow it to load dynamic content. |
|
| waitInSeconds | Optional, default none. Length to wait in seconds after solving the challenge, and before returning the results. Useful to allow it to load dynamic content. |
|
||||||
|
| disableMedia | Optional, default false. When true FlareSolverr will prevent media resources (images, CSS, and fonts) from being loaded to speed up navigation. |
|
||||||
|
|
||||||
> **Warning**
|
> **Warning**
|
||||||
> If you want to use Cloudflare clearance cookie in your scripts, make sure you use the FlareSolverr User-Agent too. If they don't match you will see the challenge.
|
> If you want to use Cloudflare clearance cookie in your scripts, make sure you use the FlareSolverr User-Agent too. If they don't match you will see the challenge.
|
||||||
@@ -275,6 +276,7 @@ This is the same as `request.get` but it takes one more param:
|
|||||||
| TZ | UTC | Timezone used in the logs and the web browser. Example: `TZ=Europe/London`. |
|
| TZ | UTC | Timezone used in the logs and the web browser. Example: `TZ=Europe/London`. |
|
||||||
| LANG | none | Language used in the web browser. Example: `LANG=en_GB`. |
|
| LANG | none | Language used in the web browser. Example: `LANG=en_GB`. |
|
||||||
| HEADLESS | true | Only for debugging. To run the web browser in headless mode or visible. |
|
| HEADLESS | true | Only for debugging. To run the web browser in headless mode or visible. |
|
||||||
|
| DISABLE_MEDIA | false | To disable loading images, CSS, and other media in the web browser to save network bandwidth. |
|
||||||
| TEST_URL | https://www.google.com | FlareSolverr makes a request on start to make sure the web browser is working. You can change that URL if it is blocked in your country. |
|
| TEST_URL | https://www.google.com | FlareSolverr makes a request on start to make sure the web browser is working. You can change that URL if it is blocked in your country. |
|
||||||
| PORT | 8191 | Listening port. You don't need to change this if you are running on Docker. |
|
| PORT | 8191 | Listening port. You don't need to change this if you are running on Docker. |
|
||||||
| HOST | 0.0.0.0 | Listening interface. You don't need to change this if you are running on Docker. |
|
| HOST | 0.0.0.0 | Listening interface. You don't need to change this if you are running on Docker. |
|
||||||
@@ -328,4 +330,3 @@ to the file name of one of the adapters inside the `/captcha` directory.
|
|||||||
|
|
||||||
* C# implementation => https://github.com/FlareSolverr/FlareSolverrSharp
|
* C# implementation => https://github.com/FlareSolverr/FlareSolverrSharp
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "flaresolverr",
|
"name": "flaresolverr",
|
||||||
"version": "3.4.4",
|
"version": "3.4.6",
|
||||||
"description": "Proxy server to bypass Cloudflare protection",
|
"description": "Proxy server to bypass Cloudflare protection",
|
||||||
"author": "Diego Heras (ngosang / ngosang@hotmail.es)",
|
"author": "Diego Heras (ngosang / ngosang@hotmail.es)",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ class V1RequestBase(object):
|
|||||||
download: bool = None # deprecated v2.0.0, not used
|
download: bool = None # deprecated v2.0.0, not used
|
||||||
returnRawHtml: bool = None # deprecated v2.0.0, not used
|
returnRawHtml: bool = None # deprecated v2.0.0, not used
|
||||||
waitInSeconds: int = None
|
waitInSeconds: int = None
|
||||||
|
# Optional resource blocking flag (blocks images, CSS, and fonts)
|
||||||
|
disableMedia: bool = None
|
||||||
|
|
||||||
def __init__(self, _dict):
|
def __init__(self, _dict):
|
||||||
self.__dict__.update(_dict)
|
self.__dict__.update(_dict)
|
||||||
|
|||||||
@@ -287,10 +287,36 @@ def _evil_logic(req: V1RequestBase, driver: WebDriver, method: str) -> Challenge
|
|||||||
res.status = STATUS_OK
|
res.status = STATUS_OK
|
||||||
res.message = ""
|
res.message = ""
|
||||||
|
|
||||||
|
# optionally block resources like images/css/fonts using CDP
|
||||||
|
disable_media = utils.get_config_disable_media()
|
||||||
|
if req.disableMedia is not None:
|
||||||
|
disable_media = req.disableMedia
|
||||||
|
if disable_media:
|
||||||
|
block_urls = [
|
||||||
|
# Images
|
||||||
|
"*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.bmp", "*.svg", "*.ico",
|
||||||
|
"*.PNG", "*.JPG", "*.JPEG", "*.GIF", "*.WEBP", "*.BMP", "*.SVG", "*.ICO",
|
||||||
|
"*.tiff", "*.tif", "*.jpe", "*.apng", "*.avif", "*.heic", "*.heif",
|
||||||
|
"*.TIFF", "*.TIF", "*.JPE", "*.APNG", "*.AVIF", "*.HEIC", "*.HEIF",
|
||||||
|
# Stylesheets
|
||||||
|
"*.css",
|
||||||
|
"*.CSS",
|
||||||
|
# Fonts
|
||||||
|
"*.woff", "*.woff2", "*.ttf", "*.otf", "*.eot",
|
||||||
|
"*.WOFF", "*.WOFF2", "*.TTF", "*.OTF", "*.EOT"
|
||||||
|
]
|
||||||
|
try:
|
||||||
|
logging.debug("Network.setBlockedURLs: %s", block_urls)
|
||||||
|
driver.execute_cdp_cmd("Network.enable", {})
|
||||||
|
driver.execute_cdp_cmd("Network.setBlockedURLs", {"urls": block_urls})
|
||||||
|
except Exception:
|
||||||
|
# if CDP commands are not available or fail, ignore and continue
|
||||||
|
logging.debug("Network.setBlockedURLs failed or unsupported on this webdriver")
|
||||||
|
|
||||||
# navigate to the page
|
# navigate to the page
|
||||||
logging.debug(f'Navigating to... {req.url}')
|
logging.debug(f"Navigating to... {req.url}")
|
||||||
if method == 'POST':
|
|
||||||
|
if method == "POST":
|
||||||
_post_request(req, driver)
|
_post_request(req, driver)
|
||||||
else:
|
else:
|
||||||
driver.get(req.url)
|
driver.get(req.url)
|
||||||
|
|||||||
23
src/tests.py
23
src/tests.py
@@ -92,6 +92,29 @@ class TestFlareSolverr(unittest.TestCase):
|
|||||||
self.assertGreater(len(solution.cookies), 0)
|
self.assertGreater(len(solution.cookies), 0)
|
||||||
self.assertIn("Chrome/", solution.userAgent)
|
self.assertIn("Chrome/", solution.userAgent)
|
||||||
|
|
||||||
|
def test_v1_endpoint_request_get_disable_resources(self):
|
||||||
|
res = self.app.post_json("/v1", {
|
||||||
|
"cmd": "request.get",
|
||||||
|
"url": self.google_url,
|
||||||
|
"disableMedia": True
|
||||||
|
})
|
||||||
|
self.assertEqual(res.status_code, 200)
|
||||||
|
|
||||||
|
body = V1ResponseBase(res.json)
|
||||||
|
self.assertEqual(STATUS_OK, body.status)
|
||||||
|
self.assertEqual("Challenge not detected!", body.message)
|
||||||
|
self.assertGreater(body.startTimestamp, 10000)
|
||||||
|
self.assertGreaterEqual(body.endTimestamp, body.startTimestamp)
|
||||||
|
self.assertEqual(utils.get_flaresolverr_version(), body.version)
|
||||||
|
|
||||||
|
solution = body.solution
|
||||||
|
self.assertIn(self.google_url, solution.url)
|
||||||
|
self.assertEqual(solution.status, 200)
|
||||||
|
self.assertIs(len(solution.headers), 0)
|
||||||
|
self.assertIn("<title>Google</title>", solution.response)
|
||||||
|
self.assertGreater(len(solution.cookies), 0)
|
||||||
|
self.assertIn("Chrome/", solution.userAgent)
|
||||||
|
|
||||||
def test_v1_endpoint_request_get_cloudflare_js_1(self):
|
def test_v1_endpoint_request_get_cloudflare_js_1(self):
|
||||||
res = self.app.post_json('/v1', {
|
res = self.app.post_json('/v1', {
|
||||||
"cmd": "request.get",
|
"cmd": "request.get",
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ def get_config_headless() -> bool:
|
|||||||
return os.environ.get('HEADLESS', 'true').lower() == 'true'
|
return os.environ.get('HEADLESS', 'true').lower() == 'true'
|
||||||
|
|
||||||
|
|
||||||
|
def get_config_disable_media() -> bool:
|
||||||
|
return os.environ.get('DISABLE_MEDIA', 'false').lower() == 'true'
|
||||||
|
|
||||||
|
|
||||||
def get_flaresolverr_version() -> str:
|
def get_flaresolverr_version() -> str:
|
||||||
global FLARESOLVERR_VERSION
|
global FLARESOLVERR_VERSION
|
||||||
if FLARESOLVERR_VERSION is not None:
|
if FLARESOLVERR_VERSION is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user