This commit is contained in:
louiscklaw
2025-02-01 02:02:07 +08:00
parent a767348238
commit 358fd197d1
13 changed files with 529 additions and 0 deletions

57
bf_helloworld.py Normal file
View File

@@ -0,0 +1,57 @@
#!/usr/bin/env python
import os,sys
from pprint import pprint
from bs4 import BeautifulSoup
import requests
main_url = "https://www.mchk.org.hk/english/list_register/list.php?page=4&ipp=20&type=L"
req = requests.get(main_url)
soup = BeautifulSoup(req.text, "html.parser")
title = soup.find("h1")
# print(title.get_text())
trs = soup.select("table#Table_5 table tr")
for tr in trs[2:]:
tds = tr.select('td')
try:
# pprint(tr)
# pprint(tds)
# print()
# # reg #
# pprint(tds[0])
# # name
# pprint(tds[1])
# # pprint(tds[2])
# # pprint(tds[3])
# # pprint(tds[4])
# # Nature of qualification
(tds[5])
# # year
# pprint(tds[7])
# print()
# print()
# print()
except Exception as e:
print('error')
print(tds[0])
break
pass
# tds = tr.select('td')
# pprint(tds)
# print()
# print()
# print()
# break
# # print(tds)
# pprint('helloworld')