mgokg commited on
Commit
7e0c763
·
verified ·
1 Parent(s): e5d9b98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -91,10 +91,18 @@ def scrape_links(links):
91
  soup = BeautifulSoup(response.content, 'html.parser')
92
  target_nav = soup.select_one('.nav')
93
  parts = link.split('/')
 
 
 
 
 
 
 
 
94
  if target_nav:
95
- details.append(f"Verein: {parts[-1]} {target_nav.text.strip()}")
96
  else:
97
- details.append("No contact information found")
98
  except Exception as e:
99
  details.append(f"Error: {str(e)}")
100
 
 
91
  soup = BeautifulSoup(response.content, 'html.parser')
92
  target_nav = soup.select_one('.nav')
93
  parts = link.split('/')
94
+
95
+ # Log the URL and its parts for debugging
96
+ print(f"Processing URL: {link}")
97
+ print(f"URL parts: {parts}")
98
+
99
+ # Extract the name of the Verein from the URL
100
+ vereinsname = parts[-1] if parts[-1] else parts[-2] # Fallback to the second-to-last part if the last part is empty
101
+
102
  if target_nav:
103
+ details.append(f"Verein: {vereinsname} {target_nav.text.strip()}")
104
  else:
105
+ details.append(f"Verein: {vereinsname} - No contact information found")
106
  except Exception as e:
107
  details.append(f"Error: {str(e)}")
108