Initial commit
This commit is contained in:
commit
5f2db08b43
100 files changed
+16985
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import sys, os
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
from bs4 import BeautifulSoup
|
||||
HTML = open("samples/assembly_dailyfile_latest.html", encoding="utf-8", errors="replace").read()
|
||||
soup = BeautifulSoup(HTML, "lxml")
|
||||
|
||||
def count(sel):
|
||||
return len(soup.select(sel))
|
||||
|
||||
print("table classes found:")
|
||||
for t in soup.select("table"):
|
||||
cls = t.get("class") or []
|
||||
print(" table.", " ".join(cls), "-> rows:", len(t.select("tr")))
|
||||
print()
|
||||
for sel in [
|
||||
"tr.committee-hearing-details",
|
||||
"tr[class*='committee-hearing-details']",
|
||||
"tr.floor-bill-details",
|
||||
"tr.class='floor-bill-details'",
|
||||
"tr[class*='committee-bills-details']",
|
||||
]:
|
||||
try:
|
||||
print(f" {sel!r}: {count(sel.replace('class=', '') if False else sel)}")
|
||||
except Exception as e:
|
||||
print(f" {sel!r}: ERROR {e}")
|
||||
Reference in new issue
Block a user