Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions scrapegraph-py/scrapegraph_py/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ async def searchscraper(
output_schema: Optional[BaseModel] = None,
extraction_mode: bool = True,
stealth: bool = False,
location_geo_code: Optional[str] = None,
return_toon: bool = False,
):
"""Send a searchscraper request
Expand All @@ -797,6 +798,7 @@ async def searchscraper(
extraction_mode: Whether to use AI extraction (True) or markdown conversion (False).
AI extraction costs 10 credits per page, markdown conversion costs 2 credits per page.
stealth: Enable stealth mode to avoid bot detection
location_geo_code: Optional geo code of the location to search in (e.g., "us")
return_toon: If True, return response in TOON format (reduces token usage by 30-60%)
"""
logger.info("🔍 Starting searchscraper request")
Expand All @@ -807,6 +809,8 @@ async def searchscraper(
logger.debug("🔧 Using custom headers")
if stealth:
logger.debug("🥷 Stealth mode enabled")
if location_geo_code:
logger.debug(f"🌍 Location geo code: {location_geo_code}")
if return_toon:
logger.debug("🎨 TOON format output enabled")

Expand All @@ -817,6 +821,7 @@ async def searchscraper(
output_schema=output_schema,
extraction_mode=extraction_mode,
stealth=stealth,
location_geo_code=location_geo_code,
)
logger.debug("✅ Request validation passed")

Expand Down
7 changes: 6 additions & 1 deletion scrapegraph-py/scrapegraph_py/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ def searchscraper(
extraction_mode: bool = True,
mock: bool=False,
stealth: bool=False,
location_geo_code: Optional[str] = None,
return_toon: bool = False,
):
"""Send a searchscraper request
Expand All @@ -808,6 +809,7 @@ def searchscraper(
AI extraction costs 10 credits per page, markdown conversion costs 2 credits per page.
mock: Enable mock mode for testing
stealth: Enable stealth mode to avoid bot detection
location_geo_code: Optional geo code of the location to search in (e.g., "us")
return_toon: If True, return response in TOON format (reduces token usage by 30-60%)
"""
logger.info("🔍 Starting searchscraper request")
Expand All @@ -818,6 +820,8 @@ def searchscraper(
logger.debug("🔧 Using custom headers")
if stealth:
logger.debug("🥷 Stealth mode enabled")
if location_geo_code:
logger.debug(f"🌍 Location geo code: {location_geo_code}")
if return_toon:
logger.debug("🎨 TOON format output enabled")

Expand All @@ -828,7 +832,8 @@ def searchscraper(
output_schema=output_schema,
extraction_mode=extraction_mode,
mock=mock,
stealth=stealth
stealth=stealth,
location_geo_code=location_geo_code,
)
logger.debug("✅ Request validation passed")

Expand Down
6 changes: 6 additions & 0 deletions scrapegraph-py/scrapegraph_py/models/searchscraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class SearchScraperRequest(BaseModel):
extraction_mode: Use AI extraction (True) or markdown (False)
mock: Whether to use mock mode for testing
render_heavy_js: Whether to render heavy JavaScript
location_geo_code: Optional geo code for location-based search (e.g., "us")

Example:
>>> request = SearchScraperRequest(
Expand Down Expand Up @@ -68,6 +69,11 @@ class SearchScraperRequest(BaseModel):
mock: bool = Field(default=False, description="Whether to use mock mode for the request")
render_heavy_js: bool = Field(default=False, description="Whether to render heavy JavaScript on the page")
stealth: bool = Field(default=False, description="Enable stealth mode to avoid bot detection")
location_geo_code: Optional[str] = Field(
None,
description="The geo code of the location to search in",
example="us",
)

@model_validator(mode="after")
def validate_user_prompt(self) -> "SearchScraperRequest":
Expand Down
Loading