Python Forum

Full Version: Scraping aspx
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I'm trying to scrap an aspx page and not sure how to get started with it. Specifically this site: http://www.quikstatsiowa.com/Default.aspx
It looks like the site is also using jquery

I'm trying to grab data from each of the sports for a group of schools to be able to easily compare data in our conference and then post it to a word press page. I've tried a WordPress scraping plugin but it doesn't pull the data very nicely so my next move is python.

This is where I've started but might be going in the wrong direction.

from bs4 import BeautifulSoup

import requests

search = input("Enter search term: ")
params = {"q": search}

r = requests.get("hhttp://www.quikstatsiowa.com/Default.aspx", params=params)

soup = BeautifulSoup(r.text, "html.parser")
print(soup.prettify())
results = soup.find("ol", {"id": "b_results"})
links = results.findall("li", {"class": "b_algo"})

for item in links:
    item_text = item.find("a").text
    item_href = item.find("a").attrs("href")
    print(item_text)
    print(item_href)
You may try Selenium. Requests module can't handle JavaScript.
Here you can see how it works: https://python-forum.io/Thread-Web-scraping-part-2