prince1604 commited on
Commit
7e72c45
·
1 Parent(s): 94af2f2

Fix URL normalization: strip trailing slash from start_url

Browse files
Files changed (1) hide show
  1. src/crawler.py +4 -0
src/crawler.py CHANGED
@@ -219,6 +219,10 @@ class Crawler:
219
  # Reset blocked state
220
  self.blocked_reason = None
221
 
 
 
 
 
222
  parsed_start = urlparse(start_url)
223
  start_domain = parsed_start.netloc
224
  base_domain = start_domain.replace('www.', '') # simplistic base domain
 
219
  # Reset blocked state
220
  self.blocked_reason = None
221
 
222
+ # Normalize start_url (remove trailing slash) to ensure consistency
223
+ # This fixes issues where https://amazon.in/ vs https://amazon.in behave differently
224
+ start_url = start_url.rstrip('/')
225
+
226
  parsed_start = urlparse(start_url)
227
  start_domain = parsed_start.netloc
228
  base_domain = start_domain.replace('www.', '') # simplistic base domain