import requests from bs4 import BeautifulSoup url='https://www.ncrczpw.com/index.php?m=jobfair&c=index&a=index' hea={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0"} response = requests.get(url,headers=hea) # print(response.url) # print(response.text) soup = BeautifulSoup(response.text, 'lxml') re = soup.select('div.td2 a') rec = [] for i in re: re2 = i.get("href") if re: print(re2) rec.append(re2) print(len(rec))