75 Commits

Author SHA1 Message Date
Karim shoair 74c5848060 fix: apply the session-level proxy when no per-request proxy is given
The per-request proxy resolution never fell back to the session default, so FetcherSession(proxy=...) was silently ignored, and requests went direct. Same fix in the sync and async paths, with regression tests asserting on the proxy that reaches curl_cffi.

Closes #295
2026-06-07 18:35:18 +03:00
Bortlesboat 6390c0af3d fix: parse quoted charset values in content-type headers
`ResponseFactory.__extract_browser_encoding` matched the charset with
`charset=([\w-]+)`, which stops at a quote character. RFC 7231 permits the
charset value to be a quoted-string (e.g. `content-type: text/html;
charset="ISO-8859-1"`), so for any quoted charset the regex failed to match
and the function silently fell back to the `utf-8` default. A page served as
quoted ISO-8859-1 / windows-1252 / Shift_JIS would then be decoded as UTF-8,
producing mojibake.

Allow an optional surrounding quote in the pattern (`charset=["']?([\w-]+)`)
so the value is captured without the quote. Unquoted headers are unaffected.

The existing `content_type_map` fixture in tests/fetchers/test_utils.py was
unused; add focused tests covering unquoted, quoted, and missing charsets.
2026-06-01 21:30:16 -04:00
Karim shoair b626b4d585 test: adding new tests for the configure function 2026-04-22 15:35:15 +02:00
voidborne-d 76ba28efaa fix(static): exclude block_ads from HTTP request args
block_ads is a browser-engine parameter (used by PlayWright/Camoufox
fetchers for ad-domain blocking) and is not recognised by curl_cffi's
Session.request(). When the CLI's --ai-targeted flag sets block_ads=True,
_merge_request_args forwards it unfiltered, causing:

  TypeError: Session.request() got an unexpected keyword argument 'block_ads'

Add block_ads to the skip_keys set so it is stripped before the dict
reaches Session.request(), consistent with existing entries for
extra_headers and google_search.

Fixes #247
2026-04-16 13:10:59 +00:00
Karim shoair d952db8ef8 feat(browsers): add a new feature to block ads
This is working by aborting all requests to known ads domains.
2026-04-12 17:59:00 +02:00
yetval 6c6aabeb73 fix: proxy rotation page pool leak 2026-04-02 11:57:17 -04:00
Karim shoair d48ac78c79 test: update tests accordingly 2026-03-09 00:28:32 +02:00
Andrew Barnes 68b9e128bc fix: return bare Google URL in referer instead of search query
Real browsers send `https://www.google.com/` as the Referer header
when clicking search results, not the full search URL with query
parameters. The previous format was a fingerprinting signal that
the referer was spoofed.

Closes #172
2026-03-08 11:32:04 -04:00
Karim shoair e34651d887 fix(stealth): improve stealth mode by removing unnecessary scripts
It doesn't add anything to the table as before (it might turn out I was wrong and add them again lol)
2026-02-27 03:50:14 +02:00
Karim shoair 0ab54852c4 fix: use more accurate naming for proxy rotation strategy
It can be considered the simplest form of round robin since we don't have weights or anything (as was originally planned), but let's change it to avoid confusion or useless debates. Here goes nothing
2026-02-14 23:19:54 +02:00
Karim shoair 16852cb1ac style: Use shorter and more accurate naming for constants 2026-02-07 16:37:47 +02:00
Karim shoair 5f557a7f9f test: add tests for the new feature 2026-02-07 01:28:58 +02:00
Karim shoair 6e0277f23b test: add new tests for the proxy rotation logic 2026-02-02 00:16:40 +02:00
Karim shoair 9eb5f68fcb test: update tests accordingly 2026-01-08 00:52:35 +02:00
Karim shoair f99baf65f7 test: remove the check for incognito 2026-01-03 01:50:46 +02:00
Karim shoair 33c5633c58 test: correcting tests with the new arguments 2025-12-30 22:06:37 +02:00
Karim shoair b1cd5c5a82 test: fix old assert test 2025-12-28 00:16:37 +02:00
Karim shoair a4ad6b5fce test: remove old test 2025-12-28 00:03:09 +02:00
Karim shoair 2af21e240d test: remove problematic sync tests
The async version are the same tests
2025-12-27 14:02:02 +02:00
Karim shoair fdfd5bf96b test: update all tests accordingly 2025-12-26 03:22:56 +02:00
Karim shoair 9443ab80ae test: update tests accordingly 2025-12-18 01:14:05 +02:00
Karim shoair ab23b71836 tests(fetchers): Update tests to use the new argument naming 2025-11-26 02:23:54 +02:00
Karim shoair 57e11cef76 tests: Update tests accordingly 2025-11-25 20:25:23 +02:00
Karim shoair 2751653190 test: add tests for the new impersonate logic 2025-11-16 16:34:24 +02:00
Karim shoair f9303ab275 test: update session tests 2025-10-06 06:53:24 +03:00
Karim shoair 390916ba45 tests: change test accordingly 2025-10-06 05:00:58 +03:00
Karim shoair 7aa083053b test: change tests accordingly 2025-10-01 03:50:57 +03:00
Karim shoair f6c122b87f style: Removing dead code/docstrings 2025-09-29 05:09:23 +03:00
Karim shoair 67aa1a2ae7 tests: Add a test for using stealth and real_chrome arguments together 2025-09-20 00:23:55 +03:00
Abdullah 7ba333c3c9 perf(session): improve page management and speed up execution
Close pages immediately after tasks finish to reduce resource usage and
improve overall performance. Update corresponding test files to reflect
the new page lifecycle management.
2025-09-17 18:49:45 +03:00
Karim shoair eae088a07b tests: Multiple changes to tests
- Remove all tests for the old encoding logic
- Stop using the `nopecha` test page to test Cloudflare solver
- Remove useless tests like testing for infinite timeout
- Fixes to make the code compatible with new changes
2025-09-14 20:24:46 +03:00
Karim shoair 68615b2347 tests: remove the cloudflare test from the sync version
To not put pressure on the website
2025-09-14 16:31:38 +03:00
Karim shoair d6844232eb tests: Update all tests according to new update 2025-09-13 16:07:54 +03:00
Karim shoair 931993f901 tests: changing tests accordingly 2025-09-08 16:09:24 +03:00
Karim shoair 878be9ccbf tests: update tests accordingly 2025-08-31 02:57:30 +03:00
Karim shoair 637580e130 tests: stop testing geoip
The DB is downloaded from GitHub releases using public API so we get rate limited a lot
2025-08-23 22:20:51 +03:00
Karim shoair dd4fcc47c8 test: remove geoip from the async camoufox test
to lower errors of rate limiting caused by downloading the geo db from GitHub
2025-08-20 16:36:58 +03:00
Karim shoair 85885d9962 tests: add geoip to Stealth tests 2025-08-20 01:36:55 +03:00
Karim shoair 5aea62256b test: adding new tests and updating existing ones
Code Coverage is now 92%
2025-08-17 01:03:19 +03:00
Karim shoair 3e0ca33111 test: adding new tests and updating existing ones 2025-08-16 19:07:08 +03:00
Karim shoair 4c33c47609 test: Update and improve Camo/Dynamic tests 2025-08-16 16:02:17 +03:00
Karim shoair e6e5b3cc80 test: adding new tests and updating existing ones
The coverage is now 78%
2025-08-16 14:58:11 +03:00
Karim shoair 0e3358007f test: adding new tests and updating existing ones 2025-08-15 04:52:51 +03:00
Karim shoair ba81890daf test: adding new tests and updating existing ones 2025-08-03 16:37:47 +03:00
Karim shoair 264ae02aa7 refactor: huge change, many features/class got a better naming
- `Adaptor` became `Selector`
- `Adaptors` became `Selectors`
- `auto_match` argument/feature became `adaptive`
- `adaptor_arguments` argument became `selector_config`
- `automatch_domain` argument became `adaptive_domain`
- `additional_arguments` argument became `additional_args`
- `storage_adaptors` file became just `storage`
2025-07-29 04:20:23 +03:00
Karim shoair ce034f9f79 test: remove problematic test 2025-06-28 18:24:08 +03:00
Karim shoair 4ee32af67b ops: fix for GitHub's CI 2025-06-27 14:50:06 +03:00
Karim shoair 228d294afc test: Enable Dynamic stealth tests again
It's problematic with GitHub but letsgo
2025-06-27 01:15:06 +03:00
Karim shoair 560ae95281 test: Adjusting tests with the correct timeout 2025-06-23 03:24:13 +03:00
Karim shoair 8b46e3a3a5 tests: Updating tests according to the new changes 2025-06-22 02:12:39 +03:00