Kratzerdaten mithilfe von Netzwerk, Fetch, Antwort

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Kratzerdaten mithilfe von Netzwerk, Fetch, Antwort

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)

Top