perf: force ad blocking on the MCP server and when the AI mode is activated on CLI
This commit is contained in:
@@ -53,6 +53,8 @@ def __Request_and_Save(
|
|||||||
if not output_path.is_absolute():
|
if not output_path.is_absolute():
|
||||||
output_path = Path.cwd() / output_file
|
output_path = Path.cwd() / output_file
|
||||||
|
|
||||||
|
if ai_targeted:
|
||||||
|
kwargs.setdefault("block_ads", True)
|
||||||
response = fetcher_func(url, **kwargs)
|
response = fetcher_func(url, **kwargs)
|
||||||
Convertor.write_content_to_file(response, str(output_path), css_selector, main_content_only=ai_targeted)
|
Convertor.write_content_to_file(response, str(output_path), css_selector, main_content_only=ai_targeted)
|
||||||
log.info(f"Content successfully saved to '{output_path}'")
|
log.info(f"Content successfully saved to '{output_path}'")
|
||||||
|
|||||||
@@ -183,6 +183,7 @@ class ScraplingMCPServer:
|
|||||||
cookies=cookies,
|
cookies=cookies,
|
||||||
cdp_url=cdp_url,
|
cdp_url=cdp_url,
|
||||||
headless=headless,
|
headless=headless,
|
||||||
|
block_ads=True,
|
||||||
max_pages=max_pages,
|
max_pages=max_pages,
|
||||||
useragent=useragent,
|
useragent=useragent,
|
||||||
timezone_id=timezone_id,
|
timezone_id=timezone_id,
|
||||||
@@ -569,6 +570,7 @@ class ScraplingMCPServer:
|
|||||||
cookies=cookies,
|
cookies=cookies,
|
||||||
cdp_url=cdp_url,
|
cdp_url=cdp_url,
|
||||||
headless=headless,
|
headless=headless,
|
||||||
|
block_ads=True,
|
||||||
max_pages=len(urls),
|
max_pages=len(urls),
|
||||||
useragent=useragent,
|
useragent=useragent,
|
||||||
timezone_id=timezone_id,
|
timezone_id=timezone_id,
|
||||||
@@ -777,6 +779,7 @@ class ScraplingMCPServer:
|
|||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
cookies=cookies,
|
cookies=cookies,
|
||||||
headless=headless,
|
headless=headless,
|
||||||
|
block_ads=True,
|
||||||
useragent=useragent,
|
useragent=useragent,
|
||||||
timezone_id=timezone_id,
|
timezone_id=timezone_id,
|
||||||
real_chrome=real_chrome,
|
real_chrome=real_chrome,
|
||||||
|
|||||||
Reference in New Issue
Block a user