Commit Graph

1380 Commits

Author SHA1 Message Date
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 ced9a8d63c v0.4.6 (#242) 2026-04-13 15:36:33 +02:00
Karim shoair 65c54f3b91 fix: duplicate ID segments in full-path selector generation (#241) 2026-04-13 12:04:20 +02:00
Karim shoair 3c23436448 Merge branch 'dev' into fix/full-path-selector-duplicate-id 2026-04-13 12:03:15 +02:00
Karim shoair c2e66ab753 docs(agent): update skill with the latest changes 2026-04-13 04:39:01 +02:00
Karim shoair 158ff04c96 docs: add the new page_setup feature 2026-04-13 04:38:23 +02:00
Karim shoair 5e13d3ece6 feat(browsers): add a pre-navigation hook to allow page setup
Solves #238
2026-04-13 03:57:27 +02:00
Karim shoair d19e861e45 fix: correct Seconds type alias to accept float values
The Seconds type was defined as `Annotated[int, float, Meta(ge=0)]` which per PEP 593 treated float as metadata, not a type. This caused passing float values like wait=1.5 to be rejected. Fixed by using Annotated[float, Meta(ge=0)] since int is a subtype of float.

Correct fix for #240

Co-Authored-By: Cocoon-Break <54054995+kuishou68@users.noreply.github.com>
2026-04-13 01:08:53 +02:00
Karim shoair d4c36ea125 Merge branch 'main' into dev 2026-04-12 20:42:19 +02:00
Karim shoair 4279ca8cbc docs(agent): update skill with the latest changes 2026-04-12 18:47:26 +02:00
Karim shoair 887eeee4c2 build: pump up version and deps 2026-04-12 18:47:13 +02:00
Karim shoair 9a7fb0b426 docs: adding the new features and updating the translated pages 2026-04-12 18:20:56 +02:00
Karim shoair ad6fd52845 perf: force ad blocking on the MCP server and when the AI mode is activated on CLI 2026-04-12 18:11:02 +02:00
Karim shoair 131b729f22 docs: adding the new features 2026-04-12 18:07:38 +02:00
Karim shoair be28fe16ec feat(browsers): add new feature to enable DNS-over-HTTP to prevent DNS leaks 2026-04-12 18:03:03 +02:00
Karim shoair 0678ed1406 fix(shell): add missing parameters to the shell signature 2026-04-12 18:00:41 +02: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
sjhddh 273c8c2fa0 fix: emit valid XPath node test for ID elements in full-path mode
Address review feedback: In full-path XPath generation, elements with
IDs were producing bare predicates like `[@id='x']` which creates
invalid XPath steps like `//body/[@id='main']`. Now emits `*[@id='x']`
for full-path mode (e.g. `//body/*[@id='main']/*[@id='target']`).

Short-path XPath mode unchanged — still uses `//*[@id='x']` prefix.

Also added XPath evaluation assertion to the regression test to verify
the generated selector actually selects the correct element.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-12 09:46:55 +02:00
sjhddh 1ac26733d8 fix: prevent duplicate ID segments in full-path selector generation
When generating full-path CSS/XPath selectors, elements with id
attributes had their selector appended twice — once in the id branch
(line 30) and again unconditionally (line 50).

This produced selectors like 'body > #main > #main > #target > #target'
instead of the correct 'body > #main > #target'.

Move the append into the else branch so it only fires for elements
without an id (elements with id already append in the if branch).

Includes 2 regression tests.
2026-04-12 01:25:45 +02:00
Karim shoair 2046527575 docs: adding a new sponsor 2026-04-08 13:30:00 +02:00
Karim shoair e5c5e7f50c docs: adding new sponsor 2026-04-08 13:24:43 +02:00
Karim shoair cb449afc81 v0.4.5 (#235) 2026-04-07 06:21:55 +02:00
Karim shoair 664e419751 docs(agent): update skill with the latest changes 2026-04-07 05:39:39 +02:00
Karim shoair 88d0459cd2 docs: adding the new development mode 2026-04-07 05:30:51 +02:00
Karim shoair fc6a0345a8 Merge branch 'main' into dev 2026-04-07 05:09:06 +02:00
Karim shoair aee6888dd5 docs: remove an old sponsor 2026-04-07 05:08:45 +02:00
Karim shoair d1baf1fc46 feat(spiders): add a development mode 2026-04-07 04:08:54 +02:00
Karim shoair fad9efdc35 fix(spider): save checkpoint before cancel_scope.cancel() on force-stop to prevent data loss (#230) 2026-04-05 22:07:56 +02:00
d 🔹 9950dde724 test: align force-stop regression stubs with dev branch 2026-04-05 19:13:19 +00:00
voidborne-d eaa0e8cae6 fix: save checkpoint before cancel_scope.cancel() on force-stop to prevent data loss
On force-stop (second Ctrl+C), cancel_scope.cancel() was called BEFORE
_save_checkpoint(). Since cancel_scope.cancel() causes all subsequent
awaits within the scope to raise Cancelled, the checkpoint write was
silently aborted:

1. _save_checkpoint() uses anyio.open_file + rename — both are await
   checkpoints that get cancelled immediately
2. self.paused never gets set to True (code after the aborted save)
3. The finally block sees 'not self.paused' and calls cleanup() which
   DELETES the previous checkpoint file

Result: a user who ran a long crawl, pressed Ctrl+C twice to force-stop,
loses their entire checkpoint irrecoverably. The old checkpoint (from
periodic saves or a previous graceful pause) is deleted, and the new
one was never written.

Fix: move the cancel_scope.cancel() call AFTER the checkpoint save.
The save completes normally, self.paused is set to True, and only then
does the scope get cancelled to abort in-flight tasks. The finally
block correctly sees paused=True and skips cleanup.

Adds 6 regression tests covering:
- Force-stop checkpoint preservation (core regression)
- Graceful pause still works
- Force-stop checkpoint is loadable
- Normal completion cleanup still works
- Force-stop without checkpoint system
- Existing checkpoint not deleted on force-stop
2026-04-05 19:11:58 +00:00
Karim shoair a61113fc29 docs(agent): update skill with the latest changes 2026-04-05 19:42:00 +02:00
Karim shoair d0a19a6fe1 build: pump version up 2026-04-05 19:41:10 +02:00
Karim shoair f756e519f3 docs: update pages with the new changes 2026-04-05 19:40:05 +02:00
Karim shoair e7f9adb40a feat(security): default follow_redirects to "safe" for SSRF protection
curl_cffi v0.15.0 introduced CurlFollow.SAFE, which follows redirects but rejects those targeting internal/private IPs (loopback, private networks, link-local). This is now the default for all HTTP fetchers, the MCP server, and the shell curl converter.

Added FollowRedirects type alias supporting all curl_cffi redirect
modes: bool, "safe", "all", "obeycode", "firstonly".
2026-04-05 18:41:50 +02:00
Karim shoair 065bf1c0e8 v0.4.4 (#229) 2026-04-05 05:37:08 +02:00
Karim shoair 087634ab67 docs: updated the translated files 2026-04-05 05:28:57 +02:00
Karim shoair 4c3ff2f0f1 docs: updating pages with the new feature 2026-04-05 05:27:07 +02:00
Karim shoair c54081ff1a docs(agent): update skill with the latest changes 2026-04-05 05:26:34 +02:00
Karim shoair 9383bec14e style(spider): removing excessive docstrings and unifying the style with the rest of the repo 2026-04-05 03:43:21 +02:00
Karim shoair 070338cf24 fix(spider): only allocate _domain_delays when robots_txt_obey is enabled 2026-04-05 02:36:15 +02:00
Karim shoair 911d3af632 build: pumping up protego minimum version 2026-04-05 02:33:15 +02:00
Karim shoair afaf68e7d5 fix(spider robots): removing dead code 2026-04-05 02:32:33 +02:00
Karim shoair ea2dd7866b refactor(spiders): Make Robots.txt compliance turned off by default
Scrapy is turning it off by default
2026-04-05 01:55:17 +02:00
Karim shoair 556a90f645 refactor(spider): prefetch robots.txt from start_urls only
Stop using allowed_domains for robots.txt prefetch since bare domain strings have no scheme info.
Domains discovered mid-crawl via requests still fetch robots.txt lazily.
2026-04-05 01:43:06 +02:00
Karim shoair ec487d37e8 fix(spider): Make delay in robots file don't affect user's concurrency settings 2026-04-05 01:39:05 +02:00
Karim shoair af83a11aa7 fix(spider robots): solve multiple issues with cache prefetch 2026-04-05 00:09:17 +02:00
Karim shoair 854daac794 style(spiders robots feat): Adjustments for maintainability 2026-04-04 21:06:35 +02:00
Karim shoair acb49b178c Merge branch 'main' into dev 2026-04-04 16:46:10 +02:00
Karim shoair 2b6251d485 feat(spiders): robots.txt compliance (#226) 2026-04-04 16:45:27 +02:00
Karim shoair fcf930c568 docs: Adding a new sponsor 2026-04-04 13:03:57 +02:00