You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
517 B
Python

from bs4 import BeautifulSoup, Tag
import httpx as h
from tabulate import tabulate
r = h.get('https://www.naqt.com/stats/school/players.jsp?org_id=69304')
html = BeautifulSoup(r.text, 'lxml')
tbl = html.find('section', attrs={'id': 'players'}).table
headers = [e.text for e in tbl.thead.tr.find_all('th')]
data = []
elem: Tag
for elem in tbl.tbody.find_all('tr'):
temp = []
for z in elem.find_all():
temp.append(z.text)
data.append(temp[1:])
print(tabulate(data, headers, showindex=False))