205 Commits

Author SHA1 Message Date
Karim shoair 6bbc6e01c5 feat(mcp/cli): Include open Shadow DOM content in the response HTML. 2026-09-13 23:37:56 +03:00
Karim shoair 5edd203076 feat(browsers): Include open Shadow DOM content in the response HTML.
Solves #440
2026-09-13 23:30:08 +03:00
Karim shoair 20337ba6a5 fix(cli): fix markdown concatenation 2026-09-12 23:18:44 +03:00
Yiğit ERDOĞAN 2947fca6d4 fix(response): fix markdown concatenation (#432) 2026-09-12 23:15:07 +03:00
Yiğit ERDOĞAN ac18622ea2 fix(static): send the request once when retries is below 1 (#420) 2026-08-23 22:09:37 +03:00
Yiğit ERDOĞAN 63cdc99cfd fix(spiders): keep the request meta on cached responses (#419) 2026-08-23 21:58:21 +03:00
Karim shoair f164713efa feat(fetchers): keep browser tabs open and reuse them across requests
Browser sessions no longer close a tab after its request is completed. The tab returns to the pool as ready, and the next request reuses it, reapplying its own timeouts, extra headers, and resource/domain routes (after `unroute_all`) so nothing leaks between requests. Tabs that hit an error or got closed by the browser are closed and evicted, and the internal response listener is detached after every request so reused tabs don't stack handlers.

Adds `close_pages()` to all browser sessions to close every open tab; the next request opens a fresh one. `PagePool` gains `get_ready_page`/`remove_page`/`clear` and `PageInfo.mark_ready`, new pages start busy, and the unused `cleanup_error_pages` is removed.

Proxy-rotation contexts keep closing per request. Docs and the agent skill describe the new lifecycle.
2026-08-23 20:28:30 +03:00
Karim shoair 6ca35d0448 feat(spiders): Adding easy interface for building RAG systems 2026-08-23 16:26:15 +03:00
Karim shoair 6e6373c997 feat(mcp): add two tools to open requests sessions and use them 2026-08-22 19:17:32 +03:00
Karim shoair 1181fc6a1f feat(mcp)!: rename get to make_request and add more methods. 2026-08-21 19:26:47 +03:00
Karim shoair 73ad18be58 refactor(mcp)!: More reliable structure + new tools
A better fix than #418 is to eliminate this bug class and keep the AI agent knowing the default parameter values.

I have also shortened the docstrings where possible to save tokens.
2026-08-21 03:16:17 +03:00
Yiğit ERDOĞAN d4e121ce7c fix(ai)!: keep session settings on MCP session fetches (#418)
The three MCP tools that accept a `session_id` forwarded every per-fetch
parameter to the session's `fetch()`, including their own defaults when
the caller supplied nothing. `validate_fetch` treats every key it
receives as an override, so the branch that reads the value from the
session config never ran, and the tool defaults replaced the settings the
session was opened with.

- Forward only the parameters the caller actually supplied
- Default those parameters to `None` on `fetch`, `bulk_fetch`,
  `stealthy_fetch`, `bulk_stealthy_fetch` and `screenshot`
- Add regression tests for the forwarded kwargs, and for the session
  settings surviving the validation the tools go through
2026-08-19 23:19:22 +03:00
Mrityunjay SIngh 0003f6444b fix(parser): keep filtering on blank class_ and escape CSS string values (#417) 2026-08-19 22:13:14 +03:00
Karim shoair c0326263b5 fix(stealth): solve Cloudflare challenges regardless of locale + retry cap + fix crashing mid-solve
The solver matched English challenge strings, so any non-default locale left the challenge unsolved.
The real cause was Playwright's context locale option patching the main thread only, while Web Workers kept the browser language, a mismatch Cloudflare rejects. Locale is now applied via browser launch flags, so the page, workers, and the Accept-Language header stay consistent, and the solver checks the language-free challenge markers with a retry cap.

Also catch patchright errors in the page-content retry so stealth pages stop crashing mid-solve.

Co-Authored-By: Parash Subedi <parash.subedi@grepsr.com>
2026-08-19 21:59:34 +03:00
Mrityunjay SIngh 029d098c06 fix: require authentication by default for the HTTP transport (#414)
Co-authored-by: MJ <kaalu@MJs-MacBook-Air.local>
2026-08-19 01:56:23 +03:00
Karim shoair 1cd938e040 build: pump version and deps 2026-08-19 01:13:30 +03:00
yetval 69a2985ada fix(parser): match multi-class elements in find/find_all class_ filter 2026-08-12 00:02:23 -04:00
Karim shoair 9bbd7c8b25 feat(spiders): Add XML/CSV feed templates + docs 2026-08-09 20:44:12 +03:00
Yiğit ERDOĞAN f8893d9b58 fix(ai): size the MCP bulk page pools within the validator bounds (#393) 2026-08-09 20:18:53 +03:00
Karim shoair 0e16c4d471 feat(mcp): add tool annotations, server card metadata, and a tools/list cache hint 2026-08-09 19:01:39 +03:00
Karim shoair e90367b7ab feat(mcp): Make tools description shorter and add server-level instructions 2026-08-09 18:36:20 +03:00
Karim shoair e978f8616d fix:(mcp): upgrade mcp server to v2
Fixes #392
2026-08-09 16:29:16 +03:00
Karim shoair 2fb5e429f2 fix(browser version): extract current chrome version from playwright package data
Fixes #394 #396 #400
2026-08-09 00:41:05 +03:00
Karim shoair 0a7fec8f86 feat(spiders): Add exporters to CSV/XML 2026-07-26 23:13:35 +03:00
Karim shoair ca51962421 feat(spiders): Auto throttle based on website speed/protection 2026-07-26 22:54:36 +03:00
Karim shoair 563b134f9e feat(mcp): Add auth to the mcp server and the option to set allowed host 2026-07-26 19:02:16 +03:00
Karim shoair 9ecffdb42f fix(cdp): Make browsers accept CDP urls with http protocol 2026-07-26 16:23:00 +03:00
Karim shoair a5fed0c622 Merge branch 'dev' into fix/cache-drops-browser-cookies 2026-07-25 16:48:55 +03:00
Karim shoair 9c3fac74ee Merge branch 'dev' into perf/get-all-text-single-pass 2026-07-24 01:29:13 +03:00
Amit Vijapur 3ed4fde93a fix(spiders): preserve cookies for browser-engine responses in cache (#376)
ResponseCacheManager.put() only recognized the flat `dict` shape that
static-engine responses use for `Response.cookies`. Browser engines
(Playwright) populate cookies as a `tuple` of full cookie dicts, so the
isinstance(dict) guard fell through to the `else {}` branch and silently
discarded every cookie before it ever reached the cache file. Replaying a
cached browser-engine response then rebuilt it with cookies={}.

Preserve whichever shape the cookies are in instead of collapsing anything
non-dict to {}: serialize a tuple as a JSON array and a dict as a JSON
object, then restore the tuple shape on read since JSON arrays deserialize
back as `list`.

Add regression tests covering both the browser-engine (tuple) and
static-engine (dict) cookie round-trip through put()/get().
2026-07-21 00:38:48 +08:00
yetval f4fc6a1baa perf(parser): make Selector.get_all_text() O(nodes) by precomputing ignored subtrees 2026-07-15 23:33:32 -04:00
Karim shoair bea8c71fc3 feat: Add option to set executable path in the CLI
Solves #371
2026-07-12 22:31:51 +03:00
Karim shoair 4022dac086 feat: add a template for Shopify websites 2026-07-12 18:44:11 +03:00
yetval 2548fbc79c fix(ai): strip control characters before extraction (#366) 2026-07-06 04:10:41 +00:00
Karim shoair 8e7bc99ebc ops: update tests workflows deps 2026-07-04 22:26:14 +03:00
Karim shoair b2681c2952 feat(parser): Add the option to integrate with Scrapy 2026-07-04 21:26:18 +03:00
Karim shoair 94ed7c8a57 Merge branch 'dev' into fix/mcp-executable-path 2026-07-04 18:56:03 +03:00
Karim shoair f81a8dcede Merge branch 'dev' into fix-playwright-page-content-encoding 2026-07-04 18:40:48 +03:00
Yehuda_LevS 0ae508f725 Fix Playwright page content encoding 2026-07-02 22:28:34 -06:00
Karim shoair 13eb6b0971 Merge branch 'dev' into fix-linkextractor-compound-extensions 2026-06-30 01:08:55 +03:00
Sami Rusani d933c947c6 feat: add MCP executable path support 2026-06-26 22:11:39 +02:00
renbkna 0d35a3f94d fix: honor compound link deny extensions 2026-06-26 10:52:38 +02:00
Karim shoair 82015b3d1f Merge branch 'dev' into fix/checkpoint-in-flight-requests 2026-06-26 11:49:32 +03:00
yetval 95687a5e37 fix: track in-flight requests by queue counter so duplicate instances are not collapsed 2026-06-23 20:31:28 +00:00
yetval d1082bd2d8 fix: keep in-flight requests in checkpoints so resume does not lose them 2026-06-22 11:27:41 -04:00
Disaster-Terminator 139ba13af6 test: align robots request-rate expectation 2026-06-17 21:09:09 +08:00
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
Karim shoair 9352ccec3f Merge branch 'dev' into fix/quoted-charset-encoding 2026-06-07 17:58:06 +03:00
Karim shoair 4ced6e4ac2 build: pump up version, browsers and deps 2026-06-07 16:16:23 +03:00
Karim shoair 3d96baf284 Merge branch 'dev' into fix/adaptive-autosave-indexerror 2026-06-07 15:53:47 +03:00