This commit is contained in:
@@ -7,7 +7,6 @@ from app.services.browser import (
|
||||
visit_url_service,
|
||||
extract_seo_service,
|
||||
extract_meta_tags_service,
|
||||
detect_pagination_service,
|
||||
capture_outgoing_calls_service,
|
||||
get_resulting_url_service
|
||||
)
|
||||
@@ -98,33 +97,6 @@ async def extract_meta_tags(url: str, skipCache: bool = False, x_api_key: Option
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
@router.get("/pagination")
|
||||
async def detect_pagination(url: str, skipCache: bool = False, x_api_key: Optional[str] = Header(None)):
|
||||
"""Detect pagination on a website and determine the pagination pattern"""
|
||||
# Validate API key
|
||||
if not x_api_key or x_api_key != API_KEY:
|
||||
raise HTTPException(status_code=401, detail="Invalid API key")
|
||||
|
||||
# Decode URL if it's encoded
|
||||
decoded_url = unquote(url)
|
||||
|
||||
# Check cache first (unless skipCache is True)
|
||||
if not skipCache:
|
||||
cached_result = get_cached_data(decoded_url, "pagination")
|
||||
if cached_result:
|
||||
return cached_result
|
||||
|
||||
try:
|
||||
# Call the service function
|
||||
result = await detect_pagination_service(decoded_url)
|
||||
|
||||
# Save to cache
|
||||
if(result["status"] == "success"):
|
||||
save_to_cache(decoded_url, "pagination", result)
|
||||
|
||||
return result
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
@router.get("/outgoing-calls")
|
||||
async def capture_outgoing_calls(url: str, skipCache: bool = False, x_api_key: Optional[str] = Header(None)):
|
||||
|
||||
Reference in New Issue
Block a user