trying to find out the logic that is behind this page:
we have stored some results in the following db:
https://www.raiffeisen.ch/rch/de/ueber-uns/raiffeisen-gruppe/organisation/raiffeisenbanken/deutsche-schweiz.html#accordionitem_18104049731620873397
from a to z approx: 120 results or more:
which Options do we have to get the data
https://www.raiffeisen.ch/zuerich/de.html#bankselector-focus-titlebar
Raiffeisenbank Zürich
Limmatquai 68
8001Zürich
Tel. +41 43 244 78 78
[email protected]
https://www.raiffeisen.ch/sennwald/de.html
Raiffeisenbank Sennwald
Äugstisriet 7
9466Sennwald
Tel. +41 81 750 40 40
[email protected]
BIC/Swift Code: RAIFCH22XXX
https://www.raiffeisen.ch/basel/de/ueber-uns/engagement.html#bankselector-focus-titlebar
Raiffeisenbank Basel
St. Jakobs-Strasse 7
4052Basel
Tel. +41 61 226 27 28
[email protected]
Hmm – i think that – if somehow all is encapsulated in the url-encoded block…
well i am trying to find it out – and here is my approach:
import requests
from bs4 import BeautifulSoup
def get_raiffeisen_data(url):
response = requests.get(url)
if response.status_code == 200:
soup = BeautifulSoup(response.content, 'html.parser')
banks = []
# Find all bank entries
bank_entries = soup.find_all('div', class_='bank-entry')
for entry in bank_entries:
bank = {}
bank['name'] = entry.find('h2', class_='bank-name').text.strip()
bank['address'] = entry.find('div', class_='bank-address').text.strip()
bank['tel'] = entry.find('div', class_='bank-tel').text.strip()
bank['email'] = entry.find('a', class_='bank-email').text.strip()
banks.append(bank)
return banks
else:
print(f"Failed to retrieve data from {url}")
return None
url = 'https://www.raiffeisen.ch/rch/de/ueber-uns/raiffeisen-gruppe/organisation/raiffeisenbanken/deutsche-schweiz.html'
banks_data = get_raiffeisen_data(url)
for bank in banks_data:
print(f"Name: {bank['name']}")
print(f"Address: {bank['address']}")
print(f"Tel: {bank['tel']}")
print(f"Email: {bank['email']}")
print('-' * 40)