afaceuser09 commited on
Commit
8cf3145
·
verified ·
1 Parent(s): 1ff0c06

Update search_pipeline.py

Browse files
Files changed (1) hide show
  1. search_pipeline.py +7 -2
search_pipeline.py CHANGED
@@ -163,15 +163,20 @@ async def search_web_async(query: str) -> list:
163
  # ---------------------------------------------------------------------
164
  # WEB SCRAPING
165
  # ---------------------------------------------------------------------
166
-
167
  async def scrape_target_url(client, result: dict):
168
  url = result["href"]
169
 
170
  try:
 
 
 
 
 
 
171
  response = await client.get(
172
  url,
173
  timeout=12.0,
174
- follow_redirects=True,
175
  )
176
 
177
  if response.status_code != 200:
 
163
  # ---------------------------------------------------------------------
164
  # WEB SCRAPING
165
  # ---------------------------------------------------------------------
 
166
  async def scrape_target_url(client, result: dict):
167
  url = result["href"]
168
 
169
  try:
170
+ # Check if using curl_cffi or standard httpx
171
+ if "curl_cffi" in str(type(client)):
172
+ kwargs = {"allow_redirects": True}
173
+ else:
174
+ kwargs = {"follow_redirects": True}
175
+
176
  response = await client.get(
177
  url,
178
  timeout=12.0,
179
+ **kwargs,
180
  )
181
 
182
  if response.status_code != 200: