by Anonymous » 26 Aug 2025, 08:57
Ich versuche, die Daten von der Website "
https://kgis.ksrsac.in/election/assembl ... ?asmbcd=94" zu kratzen, wobei "asmbcd =" variiert von 1 bis 200. Fethch/XHR -> Antwort sehen.
Code: Select all
import requests
from bs4 import BeautifulSoup
url = "https://kgis.ksrsac.in/election/Election.asmx/GetPollingStationCandidateVotes"
response = requests.get(url)
soup = BeautifulSoup(response.content, "html.parser")
table = soup.find("table", {"id": "GridData"})
rows = table.find_all("tr")
for row in rows:
cells = row.find_all("td")
if len(cells) == 3:
candidate = cells[0].text.strip()
party = cells[1].text.strip()
votes = cells[2].text.strip()
print(candidate, party, votes)
Ich versuche, die Daten von der Website "https://kgis.ksrsac.in/election/assemblyg.aspx?asmbcd=94" zu kratzen, wobei "asmbcd =" variiert von 1 bis 200. Fethch/XHR -> Antwort sehen.[code]import requests
from bs4 import BeautifulSoup
url = "https://kgis.ksrsac.in/election/Election.asmx/GetPollingStationCandidateVotes"
response = requests.get(url)
soup = BeautifulSoup(response.content, "html.parser")
table = soup.find("table", {"id": "GridData"})
rows = table.find_all("tr")
for row in rows:
cells = row.find_all("td")
if len(cells) == 3:
candidate = cells[0].text.strip()
party = cells[1].text.strip()
votes = cells[2].text.strip()
print(candidate, party, votes)
[/code]