sanjay7178 commited on
Commit
8f7dcac
1 Parent(s): 7387da9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +335 -324
README.md CHANGED
@@ -1,324 +1,335 @@
1
- # FlareSolverr
2
-
3
- [![Latest release](https://img.shields.io/github/v/release/FlareSolverr/FlareSolverr)](https://github.com/FlareSolverr/FlareSolverr/releases)
4
- [![Docker Pulls](https://img.shields.io/docker/pulls/flaresolverr/flaresolverr)](https://hub.docker.com/r/flaresolverr/flaresolverr/)
5
- [![GitHub issues](https://img.shields.io/github/issues/FlareSolverr/FlareSolverr)](https://github.com/FlareSolverr/FlareSolverr/issues)
6
- [![GitHub pull requests](https://img.shields.io/github/issues-pr/FlareSolverr/FlareSolverr)](https://github.com/FlareSolverr/FlareSolverr/pulls)
7
- [![Donate PayPal](https://img.shields.io/badge/Donate-PayPal-yellow.svg)](https://www.paypal.com/paypalme/diegoheras0xff)
8
- [![Donate Bitcoin](https://img.shields.io/badge/Donate-Bitcoin-f7931a.svg)](https://www.blockchain.com/btc/address/13Hcv77AdnFWEUZ9qUpoPBttQsUT7q9TTh)
9
- [![Donate Ethereum](https://img.shields.io/badge/Donate-Ethereum-8c8c8c.svg)](https://www.blockchain.com/eth/address/0x0D1549BbB00926BF3D92c1A8A58695e982f1BE2E)
10
-
11
- FlareSolverr is a proxy server to bypass Cloudflare and DDoS-GUARD protection.
12
-
13
- ## How it works
14
-
15
- FlareSolverr starts a proxy server, and it waits for user requests in an idle state using few resources.
16
- When some request arrives, it uses [Selenium](https://www.selenium.dev) with the
17
- [undetected-chromedriver](https://github.com/ultrafunkamsterdam/undetected-chromedriver)
18
- to create a web browser (Chrome). It opens the URL with user parameters and waits until the Cloudflare challenge
19
- is solved (or timeout). The HTML code and the cookies are sent back to the user, and those cookies can be used to
20
- bypass Cloudflare using other HTTP clients.
21
-
22
- **NOTE**: Web browsers consume a lot of memory. If you are running FlareSolverr on a machine with few RAM, do not make
23
- many requests at once. With each request a new browser is launched.
24
-
25
- It is also possible to use a permanent session. However, if you use sessions, you should make sure to close them as
26
- soon as you are done using them.
27
-
28
- ## Installation
29
-
30
- ### Docker
31
-
32
- It is recommended to install using a Docker container because the project depends on an external browser that is
33
- already included within the image.
34
-
35
- Docker images are available in:
36
- * GitHub Registry => https://github.com/orgs/FlareSolverr/packages/container/package/flaresolverr
37
- * DockerHub => https://hub.docker.com/r/flaresolverr/flaresolverr
38
-
39
- Supported architectures are:
40
-
41
- | Architecture | Tag |
42
- |--------------|--------------|
43
- | x86 | linux/386 |
44
- | x86-64 | linux/amd64 |
45
- | ARM32 | linux/arm/v7 |
46
- | ARM64 | linux/arm64 |
47
-
48
- We provide a `docker-compose.yml` configuration file. Clone this repository and execute
49
- `docker-compose up -d` _(Compose V1)_ or `docker compose up -d` _(Compose V2)_ to start
50
- the container.
51
-
52
- If you prefer the `docker cli` execute the following command.
53
- ```bash
54
- docker run -d \
55
- --name=flaresolverr \
56
- -p 8191:8191 \
57
- -e LOG_LEVEL=info \
58
- --restart unless-stopped \
59
- ghcr.io/flaresolverr/flaresolverr:latest
60
- ```
61
-
62
- If your host OS is Debian, make sure `libseccomp2` version is 2.5.x. You can check the version with `sudo apt-cache policy libseccomp2`
63
- and update the package with `sudo apt install libseccomp2=2.5.1-1~bpo10+1` or `sudo apt install libseccomp2=2.5.1-1+deb11u1`.
64
- Remember to restart the Docker daemon and the container after the update.
65
-
66
- ### Precompiled binaries
67
-
68
- > **Warning**
69
- > Precompiled binaries are only available for x64 architecture. For other architectures see Docker images.
70
-
71
- This is the recommended way for Windows users.
72
- * Download the [FlareSolverr executable](https://github.com/FlareSolverr/FlareSolverr/releases) from the release's page. It is available for Windows x64 and Linux x64.
73
- * Execute FlareSolverr binary. In the environment variables section you can find how to change the configuration.
74
-
75
- ### From source code
76
-
77
- > **Warning**
78
- > Installing from source code only works for x64 architecture. For other architectures see Docker images.
79
-
80
- * Install [Python 3.11](https://www.python.org/downloads/).
81
- * 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.
82
- * (Only in Linux) Install [Xvfb](https://en.wikipedia.org/wiki/Xvfb) package.
83
- * (Only in macOS) Install [XQuartz](https://www.xquartz.org/) package.
84
- * Clone this repository and open a shell in that path.
85
- * Run `pip install -r requirements.txt` command to install FlareSolverr dependencies.
86
- * Run `python src/flaresolverr.py` command to start FlareSolverr.
87
-
88
- ### From source code (FreeBSD/TrueNAS CORE)
89
-
90
- * Run `pkg install chromium python39 py39-pip xorg-vfbserver` command to install the required dependencies.
91
- * Clone this repository and open a shell in that path.
92
- * Run `python3.9 -m pip install -r requirements.txt` command to install FlareSolverr dependencies.
93
- * Run `python3.9 src/flaresolverr.py` command to start FlareSolverr.
94
-
95
- ### Systemd service
96
-
97
- We provide an example Systemd unit file `flaresolverr.service` as reference. You have to modify the file to suit your needs: paths, user and environment variables.
98
-
99
- ## Usage
100
-
101
- Example Bash request:
102
- ```bash
103
- curl -L -X POST 'http://localhost:8191/v1' \
104
- -H 'Content-Type: application/json' \
105
- --data-raw '{
106
- "cmd": "request.get",
107
- "url": "http://www.google.com/",
108
- "maxTimeout": 60000
109
- }'
110
- ```
111
-
112
- Example Python request:
113
- ```py
114
- import requests
115
-
116
- url = "http://localhost:8191/v1"
117
- headers = {"Content-Type": "application/json"}
118
- data = {
119
- "cmd": "request.get",
120
- "url": "http://www.google.com/",
121
- "maxTimeout": 60000
122
- }
123
- response = requests.post(url, headers=headers, json=data)
124
- print(response.text)
125
- ```
126
-
127
- Example PowerShell request:
128
- ```ps1
129
- $body = @{
130
- cmd = "request.get"
131
- url = "http://www.google.com/"
132
- maxTimeout = 60000
133
- } | ConvertTo-Json
134
-
135
- irm -UseBasicParsing 'http://localhost:8191/v1' -Headers @{"Content-Type"="application/json"} -Method Post -Body $body
136
- ```
137
-
138
- ### Commands
139
-
140
- #### + `sessions.create`
141
-
142
- This will launch a new browser instance which will retain cookies until you destroy it with `sessions.destroy`.
143
- This comes in handy, so you don't have to keep solving challenges over and over and you won't need to keep sending
144
- cookies for the browser to use.
145
-
146
- This also speeds up the requests since it won't have to launch a new browser instance for every request.
147
-
148
- | Parameter | Notes |
149
- |-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
150
- | session | Optional. The session ID that you want to be assigned to the instance. If isn't set a random UUID will be assigned. |
151
- | 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 supported. Eg: `"proxy": {"url": "http://127.0.0.1:8888", "username": "testuser", "password": "testpass"}` |
152
-
153
- #### + `sessions.list`
154
-
155
- Returns a list of all the active sessions. More for debugging if you are curious to see how many sessions are running.
156
- You should always make sure to properly close each session when you are done using them as too many may slow your
157
- computer down.
158
-
159
- Example response:
160
-
161
- ```json
162
- {
163
- "sessions": [
164
- "session_id_1",
165
- "session_id_2",
166
- "session_id_3..."
167
- ]
168
- }
169
- ```
170
-
171
- #### + `sessions.destroy`
172
-
173
- This will properly shutdown a browser instance and remove all files associated with it to free up resources for a new
174
- session. When you no longer need to use a session you should make sure to close it.
175
-
176
- | Parameter | Notes |
177
- |-----------|-----------------------------------------------|
178
- | session | The session ID that you want to be destroyed. |
179
-
180
- #### + `request.get`
181
-
182
- | Parameter | Notes |
183
- |---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
184
- | url | Mandatory |
185
- | session | Optional. Will send the request from and existing browser instance. If one is not sent it will create a temporary instance that will be destroyed immediately after the request is completed. |
186
- | session_ttl_minutes | Optional. FlareSolverr will automatically rotate expired sessions based on the TTL provided in minutes. |
187
- | maxTimeout | Optional, default value 60000. Max timeout to solve the challenge in milliseconds. |
188
- | cookies | Optional. Will be used by the headless browser. Eg: `"cookies": [{"name": "cookie1", "value": "value1"}, {"name": "cookie2", "value": "value2"}]`. |
189
- | returnOnlyCookies | Optional, default false. Only returns the cookies. Response data, headers and other parts of the response are removed. |
190
- | 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`.) |
191
-
192
- > **Warning**
193
- > 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.
194
-
195
- Example response from running the `curl` above:
196
-
197
- ```json
198
- {
199
- "solution": {
200
- "url": "https://www.google.com/?gws_rd=ssl",
201
- "status": 200,
202
- "headers": {
203
- "status": "200",
204
- "date": "Thu, 16 Jul 2020 04:15:49 GMT",
205
- "expires": "-1",
206
- "cache-control": "private, max-age=0",
207
- "content-type": "text/html; charset=UTF-8",
208
- "strict-transport-security": "max-age=31536000",
209
- "p3p": "CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\"",
210
- "content-encoding": "br",
211
- "server": "gws",
212
- "content-length": "61587",
213
- "x-xss-protection": "0",
214
- "x-frame-options": "SAMEORIGIN",
215
- "set-cookie": "1P_JAR=2020-07-16-04; expires=Sat..."
216
- },
217
- "response":"<!DOCTYPE html>...",
218
- "cookies": [
219
- {
220
- "name": "NID",
221
- "value": "204=QE3Ocq15XalczqjuDy52HeseG3zAZuJzID3R57...",
222
- "domain": ".google.com",
223
- "path": "/",
224
- "expires": 1610684149.307722,
225
- "size": 178,
226
- "httpOnly": true,
227
- "secure": true,
228
- "session": false,
229
- "sameSite": "None"
230
- },
231
- {
232
- "name": "1P_JAR",
233
- "value": "2020-07-16-04",
234
- "domain": ".google.com",
235
- "path": "/",
236
- "expires": 1597464949.307626,
237
- "size": 19,
238
- "httpOnly": false,
239
- "secure": true,
240
- "session": false,
241
- "sameSite": "None"
242
- }
243
- ],
244
- "userAgent": "Windows NT 10.0; Win64; x64) AppleWebKit/5..."
245
- },
246
- "status": "ok",
247
- "message": "",
248
- "startTimestamp": 1594872947467,
249
- "endTimestamp": 1594872949617,
250
- "version": "1.0.0"
251
- }
252
- ```
253
-
254
- ### + `request.post`
255
-
256
- This is the same as `request.get` but it takes one more param:
257
-
258
- | Parameter | Notes |
259
- |-----------|--------------------------------------------------------------------------|
260
- | postData | Must be a string with `application/x-www-form-urlencoded`. Eg: `a=b&c=d` |
261
-
262
- ## Environment variables
263
-
264
- | Name | Default | Notes |
265
- |--------------------|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
266
- | LOG_LEVEL | info | Verbosity of the logging. Use `LOG_LEVEL=debug` for more information. |
267
- | LOG_HTML | false | Only for debugging. If `true` all HTML that passes through the proxy will be logged to the console in `debug` level. |
268
- | CAPTCHA_SOLVER | none | Captcha solving method. It is used when a captcha is encountered. See the Captcha Solvers section. |
269
- | TZ | UTC | Timezone used in the logs and the web browser. Example: `TZ=Europe/London`. |
270
- | LANG | none | Language used in the web browser. Example: `LANG=en_GB`. |
271
- | HEADLESS | true | Only for debugging. To run the web browser in headless mode or visible. |
272
- | BROWSER_TIMEOUT | 40000 | If you are experiencing errors/timeouts because your system is slow, you can try to increase this value. Remember to increase the `maxTimeout` parameter too. |
273
- | 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. |
274
- | PORT | 8191 | Listening port. You don't need to change this if you are running on Docker. |
275
- | HOST | 0.0.0.0 | Listening interface. You don't need to change this if you are running on Docker. |
276
- | PROMETHEUS_ENABLED | false | Enable Prometheus exporter. See the Prometheus section below. |
277
- | PROMETHEUS_PORT | 8192 | Listening port for Prometheus exporter. See the Prometheus section below. |
278
-
279
- Environment variables are set differently depending on the operating system. Some examples:
280
- * Docker: Take a look at the Docker section in this document. Environment variables can be set in the `docker-compose.yml` file or in the Docker CLI command.
281
- * Linux: Run `export LOG_LEVEL=debug` and then run `flaresolverr` in the same shell.
282
- * Windows: Open `cmd.exe`, run `set LOG_LEVEL=debug` and then run `flaresolverr.exe` in the same shell.
283
-
284
- ## Prometheus exporter
285
-
286
- The Prometheus exporter for FlareSolverr is disabled by default. It can be enabled with the environment variable `PROMETHEUS_ENABLED`. If you are using Docker make sure you expose the `PROMETHEUS_PORT`.
287
-
288
- Example metrics:
289
- ```shell
290
- # HELP flaresolverr_request_total Total requests with result
291
- # TYPE flaresolverr_request_total counter
292
- flaresolverr_request_total{domain="nowsecure.nl",result="solved"} 1.0
293
- # HELP flaresolverr_request_created Total requests with result
294
- # TYPE flaresolverr_request_created gauge
295
- flaresolverr_request_created{domain="nowsecure.nl",result="solved"} 1.690141657157109e+09
296
- # HELP flaresolverr_request_duration Request duration in seconds
297
- # TYPE flaresolverr_request_duration histogram
298
- flaresolverr_request_duration_bucket{domain="nowsecure.nl",le="0.0"} 0.0
299
- flaresolverr_request_duration_bucket{domain="nowsecure.nl",le="10.0"} 1.0
300
- flaresolverr_request_duration_bucket{domain="nowsecure.nl",le="25.0"} 1.0
301
- flaresolverr_request_duration_bucket{domain="nowsecure.nl",le="50.0"} 1.0
302
- flaresolverr_request_duration_bucket{domain="nowsecure.nl",le="+Inf"} 1.0
303
- flaresolverr_request_duration_count{domain="nowsecure.nl"} 1.0
304
- flaresolverr_request_duration_sum{domain="nowsecure.nl"} 5.858
305
- # HELP flaresolverr_request_duration_created Request duration in seconds
306
- # TYPE flaresolverr_request_duration_created gauge
307
- flaresolverr_request_duration_created{domain="nowsecure.nl"} 1.6901416571570296e+09
308
- ```
309
-
310
- ## Captcha Solvers
311
-
312
- > **Warning**
313
- > At this time none of the captcha solvers work. You can check the status in the open issues. Any help is welcome.
314
-
315
- Sometimes CloudFlare not only gives mathematical computations and browser tests, sometimes they also require the user to
316
- solve a captcha.
317
- If this is the case, FlareSolverr will return the error `Captcha detected but no automatic solver is configured.`
318
-
319
- FlareSolverr can be customized to solve the CAPTCHA automatically by setting the environment variable `CAPTCHA_SOLVER`
320
- to the file name of one of the adapters inside the [/captcha](src/captcha) directory.
321
-
322
- ## Related projects
323
-
324
- * C# implementation => https://github.com/FlareSolverr/FlareSolverrSharp
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: FlareSolver
3
+ emoji: ️‍🔥
4
+ colorFrom: "red"
5
+ colorTo: "blue"
6
+ sdk: "docker"
7
+ sdk_version: "v1.1"
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ # FlareSolverr
13
+
14
+ [![Latest release](https://img.shields.io/github/v/release/FlareSolverr/FlareSolverr)](https://github.com/FlareSolverr/FlareSolverr/releases)
15
+ [![Docker Pulls](https://img.shields.io/docker/pulls/flaresolverr/flaresolverr)](https://hub.docker.com/r/flaresolverr/flaresolverr/)
16
+ [![GitHub issues](https://img.shields.io/github/issues/FlareSolverr/FlareSolverr)](https://github.com/FlareSolverr/FlareSolverr/issues)
17
+ [![GitHub pull requests](https://img.shields.io/github/issues-pr/FlareSolverr/FlareSolverr)](https://github.com/FlareSolverr/FlareSolverr/pulls)
18
+ [![Donate PayPal](https://img.shields.io/badge/Donate-PayPal-yellow.svg)](https://www.paypal.com/paypalme/diegoheras0xff)
19
+ [![Donate Bitcoin](https://img.shields.io/badge/Donate-Bitcoin-f7931a.svg)](https://www.blockchain.com/btc/address/13Hcv77AdnFWEUZ9qUpoPBttQsUT7q9TTh)
20
+ [![Donate Ethereum](https://img.shields.io/badge/Donate-Ethereum-8c8c8c.svg)](https://www.blockchain.com/eth/address/0x0D1549BbB00926BF3D92c1A8A58695e982f1BE2E)
21
+
22
+ FlareSolverr is a proxy server to bypass Cloudflare and DDoS-GUARD protection.
23
+
24
+ ## How it works
25
+
26
+ FlareSolverr starts a proxy server, and it waits for user requests in an idle state using few resources.
27
+ When some request arrives, it uses [Selenium](https://www.selenium.dev) with the
28
+ [undetected-chromedriver](https://github.com/ultrafunkamsterdam/undetected-chromedriver)
29
+ to create a web browser (Chrome). It opens the URL with user parameters and waits until the Cloudflare challenge
30
+ is solved (or timeout). The HTML code and the cookies are sent back to the user, and those cookies can be used to
31
+ bypass Cloudflare using other HTTP clients.
32
+
33
+ **NOTE**: Web browsers consume a lot of memory. If you are running FlareSolverr on a machine with few RAM, do not make
34
+ many requests at once. With each request a new browser is launched.
35
+
36
+ It is also possible to use a permanent session. However, if you use sessions, you should make sure to close them as
37
+ soon as you are done using them.
38
+
39
+ ## Installation
40
+
41
+ ### Docker
42
+
43
+ It is recommended to install using a Docker container because the project depends on an external browser that is
44
+ already included within the image.
45
+
46
+ Docker images are available in:
47
+ * GitHub Registry => https://github.com/orgs/FlareSolverr/packages/container/package/flaresolverr
48
+ * DockerHub => https://hub.docker.com/r/flaresolverr/flaresolverr
49
+
50
+ Supported architectures are:
51
+
52
+ | Architecture | Tag |
53
+ |--------------|--------------|
54
+ | x86 | linux/386 |
55
+ | x86-64 | linux/amd64 |
56
+ | ARM32 | linux/arm/v7 |
57
+ | ARM64 | linux/arm64 |
58
+
59
+ We provide a `docker-compose.yml` configuration file. Clone this repository and execute
60
+ `docker-compose up -d` _(Compose V1)_ or `docker compose up -d` _(Compose V2)_ to start
61
+ the container.
62
+
63
+ If you prefer the `docker cli` execute the following command.
64
+ ```bash
65
+ docker run -d \
66
+ --name=flaresolverr \
67
+ -p 8191:8191 \
68
+ -e LOG_LEVEL=info \
69
+ --restart unless-stopped \
70
+ ghcr.io/flaresolverr/flaresolverr:latest
71
+ ```
72
+
73
+ If your host OS is Debian, make sure `libseccomp2` version is 2.5.x. You can check the version with `sudo apt-cache policy libseccomp2`
74
+ and update the package with `sudo apt install libseccomp2=2.5.1-1~bpo10+1` or `sudo apt install libseccomp2=2.5.1-1+deb11u1`.
75
+ Remember to restart the Docker daemon and the container after the update.
76
+
77
+ ### Precompiled binaries
78
+
79
+ > **Warning**
80
+ > Precompiled binaries are only available for x64 architecture. For other architectures see Docker images.
81
+
82
+ This is the recommended way for Windows users.
83
+ * Download the [FlareSolverr executable](https://github.com/FlareSolverr/FlareSolverr/releases) from the release's page. It is available for Windows x64 and Linux x64.
84
+ * Execute FlareSolverr binary. In the environment variables section you can find how to change the configuration.
85
+
86
+ ### From source code
87
+
88
+ > **Warning**
89
+ > Installing from source code only works for x64 architecture. For other architectures see Docker images.
90
+
91
+ * Install [Python 3.11](https://www.python.org/downloads/).
92
+ * 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.
93
+ * (Only in Linux) Install [Xvfb](https://en.wikipedia.org/wiki/Xvfb) package.
94
+ * (Only in macOS) Install [XQuartz](https://www.xquartz.org/) package.
95
+ * Clone this repository and open a shell in that path.
96
+ * Run `pip install -r requirements.txt` command to install FlareSolverr dependencies.
97
+ * Run `python src/flaresolverr.py` command to start FlareSolverr.
98
+
99
+ ### From source code (FreeBSD/TrueNAS CORE)
100
+
101
+ * Run `pkg install chromium python39 py39-pip xorg-vfbserver` command to install the required dependencies.
102
+ * Clone this repository and open a shell in that path.
103
+ * Run `python3.9 -m pip install -r requirements.txt` command to install FlareSolverr dependencies.
104
+ * Run `python3.9 src/flaresolverr.py` command to start FlareSolverr.
105
+
106
+ ### Systemd service
107
+
108
+ We provide an example Systemd unit file `flaresolverr.service` as reference. You have to modify the file to suit your needs: paths, user and environment variables.
109
+
110
+ ## Usage
111
+
112
+ Example Bash request:
113
+ ```bash
114
+ curl -L -X POST 'http://localhost:8191/v1' \
115
+ -H 'Content-Type: application/json' \
116
+ --data-raw '{
117
+ "cmd": "request.get",
118
+ "url": "http://www.google.com/",
119
+ "maxTimeout": 60000
120
+ }'
121
+ ```
122
+
123
+ Example Python request:
124
+ ```py
125
+ import requests
126
+
127
+ url = "http://localhost:8191/v1"
128
+ headers = {"Content-Type": "application/json"}
129
+ data = {
130
+ "cmd": "request.get",
131
+ "url": "http://www.google.com/",
132
+ "maxTimeout": 60000
133
+ }
134
+ response = requests.post(url, headers=headers, json=data)
135
+ print(response.text)
136
+ ```
137
+
138
+ Example PowerShell request:
139
+ ```ps1
140
+ $body = @{
141
+ cmd = "request.get"
142
+ url = "http://www.google.com/"
143
+ maxTimeout = 60000
144
+ } | ConvertTo-Json
145
+
146
+ irm -UseBasicParsing 'http://localhost:8191/v1' -Headers @{"Content-Type"="application/json"} -Method Post -Body $body
147
+ ```
148
+
149
+ ### Commands
150
+
151
+ #### + `sessions.create`
152
+
153
+ This will launch a new browser instance which will retain cookies until you destroy it with `sessions.destroy`.
154
+ This comes in handy, so you don't have to keep solving challenges over and over and you won't need to keep sending
155
+ cookies for the browser to use.
156
+
157
+ This also speeds up the requests since it won't have to launch a new browser instance for every request.
158
+
159
+ | Parameter | Notes |
160
+ |-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
161
+ | session | Optional. The session ID that you want to be assigned to the instance. If isn't set a random UUID will be assigned. |
162
+ | 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 supported. Eg: `"proxy": {"url": "http://127.0.0.1:8888", "username": "testuser", "password": "testpass"}` |
163
+
164
+ #### + `sessions.list`
165
+
166
+ Returns a list of all the active sessions. More for debugging if you are curious to see how many sessions are running.
167
+ You should always make sure to properly close each session when you are done using them as too many may slow your
168
+ computer down.
169
+
170
+ Example response:
171
+
172
+ ```json
173
+ {
174
+ "sessions": [
175
+ "session_id_1",
176
+ "session_id_2",
177
+ "session_id_3..."
178
+ ]
179
+ }
180
+ ```
181
+
182
+ #### + `sessions.destroy`
183
+
184
+ This will properly shutdown a browser instance and remove all files associated with it to free up resources for a new
185
+ session. When you no longer need to use a session you should make sure to close it.
186
+
187
+ | Parameter | Notes |
188
+ |-----------|-----------------------------------------------|
189
+ | session | The session ID that you want to be destroyed. |
190
+
191
+ #### + `request.get`
192
+
193
+ | Parameter | Notes |
194
+ |---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
195
+ | url | Mandatory |
196
+ | session | Optional. Will send the request from and existing browser instance. If one is not sent it will create a temporary instance that will be destroyed immediately after the request is completed. |
197
+ | session_ttl_minutes | Optional. FlareSolverr will automatically rotate expired sessions based on the TTL provided in minutes. |
198
+ | maxTimeout | Optional, default value 60000. Max timeout to solve the challenge in milliseconds. |
199
+ | cookies | Optional. Will be used by the headless browser. Eg: `"cookies": [{"name": "cookie1", "value": "value1"}, {"name": "cookie2", "value": "value2"}]`. |
200
+ | returnOnlyCookies | Optional, default false. Only returns the cookies. Response data, headers and other parts of the response are removed. |
201
+ | 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`.) |
202
+
203
+ > **Warning**
204
+ > 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.
205
+
206
+ Example response from running the `curl` above:
207
+
208
+ ```json
209
+ {
210
+ "solution": {
211
+ "url": "https://www.google.com/?gws_rd=ssl",
212
+ "status": 200,
213
+ "headers": {
214
+ "status": "200",
215
+ "date": "Thu, 16 Jul 2020 04:15:49 GMT",
216
+ "expires": "-1",
217
+ "cache-control": "private, max-age=0",
218
+ "content-type": "text/html; charset=UTF-8",
219
+ "strict-transport-security": "max-age=31536000",
220
+ "p3p": "CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\"",
221
+ "content-encoding": "br",
222
+ "server": "gws",
223
+ "content-length": "61587",
224
+ "x-xss-protection": "0",
225
+ "x-frame-options": "SAMEORIGIN",
226
+ "set-cookie": "1P_JAR=2020-07-16-04; expires=Sat..."
227
+ },
228
+ "response":"<!DOCTYPE html>...",
229
+ "cookies": [
230
+ {
231
+ "name": "NID",
232
+ "value": "204=QE3Ocq15XalczqjuDy52HeseG3zAZuJzID3R57...",
233
+ "domain": ".google.com",
234
+ "path": "/",
235
+ "expires": 1610684149.307722,
236
+ "size": 178,
237
+ "httpOnly": true,
238
+ "secure": true,
239
+ "session": false,
240
+ "sameSite": "None"
241
+ },
242
+ {
243
+ "name": "1P_JAR",
244
+ "value": "2020-07-16-04",
245
+ "domain": ".google.com",
246
+ "path": "/",
247
+ "expires": 1597464949.307626,
248
+ "size": 19,
249
+ "httpOnly": false,
250
+ "secure": true,
251
+ "session": false,
252
+ "sameSite": "None"
253
+ }
254
+ ],
255
+ "userAgent": "Windows NT 10.0; Win64; x64) AppleWebKit/5..."
256
+ },
257
+ "status": "ok",
258
+ "message": "",
259
+ "startTimestamp": 1594872947467,
260
+ "endTimestamp": 1594872949617,
261
+ "version": "1.0.0"
262
+ }
263
+ ```
264
+
265
+ ### + `request.post`
266
+
267
+ This is the same as `request.get` but it takes one more param:
268
+
269
+ | Parameter | Notes |
270
+ |-----------|--------------------------------------------------------------------------|
271
+ | postData | Must be a string with `application/x-www-form-urlencoded`. Eg: `a=b&c=d` |
272
+
273
+ ## Environment variables
274
+
275
+ | Name | Default | Notes |
276
+ |--------------------|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
277
+ | LOG_LEVEL | info | Verbosity of the logging. Use `LOG_LEVEL=debug` for more information. |
278
+ | LOG_HTML | false | Only for debugging. If `true` all HTML that passes through the proxy will be logged to the console in `debug` level. |
279
+ | CAPTCHA_SOLVER | none | Captcha solving method. It is used when a captcha is encountered. See the Captcha Solvers section. |
280
+ | TZ | UTC | Timezone used in the logs and the web browser. Example: `TZ=Europe/London`. |
281
+ | LANG | none | Language used in the web browser. Example: `LANG=en_GB`. |
282
+ | HEADLESS | true | Only for debugging. To run the web browser in headless mode or visible. |
283
+ | BROWSER_TIMEOUT | 40000 | If you are experiencing errors/timeouts because your system is slow, you can try to increase this value. Remember to increase the `maxTimeout` parameter too. |
284
+ | 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. |
285
+ | PORT | 8191 | Listening port. You don't need to change this if you are running on Docker. |
286
+ | HOST | 0.0.0.0 | Listening interface. You don't need to change this if you are running on Docker. |
287
+ | PROMETHEUS_ENABLED | false | Enable Prometheus exporter. See the Prometheus section below. |
288
+ | PROMETHEUS_PORT | 8192 | Listening port for Prometheus exporter. See the Prometheus section below. |
289
+
290
+ Environment variables are set differently depending on the operating system. Some examples:
291
+ * Docker: Take a look at the Docker section in this document. Environment variables can be set in the `docker-compose.yml` file or in the Docker CLI command.
292
+ * Linux: Run `export LOG_LEVEL=debug` and then run `flaresolverr` in the same shell.
293
+ * Windows: Open `cmd.exe`, run `set LOG_LEVEL=debug` and then run `flaresolverr.exe` in the same shell.
294
+
295
+ ## Prometheus exporter
296
+
297
+ The Prometheus exporter for FlareSolverr is disabled by default. It can be enabled with the environment variable `PROMETHEUS_ENABLED`. If you are using Docker make sure you expose the `PROMETHEUS_PORT`.
298
+
299
+ Example metrics:
300
+ ```shell
301
+ # HELP flaresolverr_request_total Total requests with result
302
+ # TYPE flaresolverr_request_total counter
303
+ flaresolverr_request_total{domain="nowsecure.nl",result="solved"} 1.0
304
+ # HELP flaresolverr_request_created Total requests with result
305
+ # TYPE flaresolverr_request_created gauge
306
+ flaresolverr_request_created{domain="nowsecure.nl",result="solved"} 1.690141657157109e+09
307
+ # HELP flaresolverr_request_duration Request duration in seconds
308
+ # TYPE flaresolverr_request_duration histogram
309
+ flaresolverr_request_duration_bucket{domain="nowsecure.nl",le="0.0"} 0.0
310
+ flaresolverr_request_duration_bucket{domain="nowsecure.nl",le="10.0"} 1.0
311
+ flaresolverr_request_duration_bucket{domain="nowsecure.nl",le="25.0"} 1.0
312
+ flaresolverr_request_duration_bucket{domain="nowsecure.nl",le="50.0"} 1.0
313
+ flaresolverr_request_duration_bucket{domain="nowsecure.nl",le="+Inf"} 1.0
314
+ flaresolverr_request_duration_count{domain="nowsecure.nl"} 1.0
315
+ flaresolverr_request_duration_sum{domain="nowsecure.nl"} 5.858
316
+ # HELP flaresolverr_request_duration_created Request duration in seconds
317
+ # TYPE flaresolverr_request_duration_created gauge
318
+ flaresolverr_request_duration_created{domain="nowsecure.nl"} 1.6901416571570296e+09
319
+ ```
320
+
321
+ ## Captcha Solvers
322
+
323
+ > **Warning**
324
+ > At this time none of the captcha solvers work. You can check the status in the open issues. Any help is welcome.
325
+
326
+ Sometimes CloudFlare not only gives mathematical computations and browser tests, sometimes they also require the user to
327
+ solve a captcha.
328
+ If this is the case, FlareSolverr will return the error `Captcha detected but no automatic solver is configured.`
329
+
330
+ FlareSolverr can be customized to solve the CAPTCHA automatically by setting the environment variable `CAPTCHA_SOLVER`
331
+ to the file name of one of the adapters inside the [/captcha](src/captcha) directory.
332
+
333
+ ## Related projects
334
+
335
+ * C# implementation => https://github.com/FlareSolverr/FlareSolverrSharp