42Cummer commited on
Commit
cb17087
·
verified ·
1 Parent(s): c2a5c17

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -72,6 +72,22 @@ def getRouteList():
72
 
73
  routes[rid] = text
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  for rid in range(900, 999): # all express routes
76
  tag = soup.find("p", {"id": str(rid)})
77
  if tag and tag.text.strip():
 
72
 
73
  routes[rid] = text
74
 
75
+ for rid in range(500, 599): # all streetcar routes
76
+ tag = soup.find("p", {"id": str(rid)})
77
+ if tag and tag.text.strip():
78
+ # Clean text:
79
+ text = tag.get_text(strip=True)
80
+
81
+ # Remove leading symbols like "*" or "== $0"
82
+ text = re.sub(r"^[^A-Za-z0-9]+", "", text) # strip non-alphanumeric at start
83
+ text = re.sub(r"\s*==.*$", "", text) # strip trailing "== $0" or similar
84
+ text = re.sub(r"\s+", " ", text).strip() # collapse spaces
85
+
86
+ # Replace dash between number and name with space (e.g., "26-Dupont" -> "26 Dupont")
87
+ text = re.sub(r'(\d+)-([A-Za-z])', r'\1 \2', text)
88
+
89
+ routes[rid] = text
90
+
91
  for rid in range(900, 999): # all express routes
92
  tag = soup.find("p", {"id": str(rid)})
93
  if tag and tag.text.strip():